Binary file build/loc/resources.jar has changed
--- a/build/makefile.javaversion Fri Jul 23 12:27:20 2010 +0300
+++ b/build/makefile.javaversion Thu Aug 05 16:07:57 2010 +0300
@@ -1,2 +1,2 @@
# Set Java version (must be dot separated, without spaces)
-JAVA_VERSION = 2.2.7
+JAVA_VERSION = 2.2.9
--- a/inc/build_defines.hrh Fri Jul 23 12:27:20 2010 +0300
+++ b/inc/build_defines.hrh Thu Aug 05 16:07:57 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-#define RD_JAVA_VERSION 2,2,7
+#define RD_JAVA_VERSION 2,2,9
#define RD_JAVA_SYMBIAN_TARGET
#define RD_JAVA_S60_RELEASE_10_1
#define RD_JAVA_S60_RELEASE_10_1_ONWARDS
--- a/inc/java.txt Fri Jul 23 12:27:20 2010 +0300
+++ b/inc/java.txt Thu Aug 05 16:07:57 2010 +0300
@@ -1,1 +1,1 @@
-2.2.7
+2.2.9
--- a/javacommons/gcfprotocols/http/build/javahttp.pro Fri Jul 23 12:27:20 2010 +0300
+++ b/javacommons/gcfprotocols/http/build/javahttp.pro Thu Aug 05 16:07:57 2010 +0300
@@ -18,18 +18,10 @@
TARGET=javahttp
TEMPLATE=lib
CONFIG += omj java stl
-CONFIG -= qt
symbian {
- LIBS += -leuser -lhttp -lecom -lbafl -linetprotutil -lhttpfiltercommon -lx509 -lx500 -lcrypto -lesock -lcommdb -lcentralrepository
-
- contains(PROJECT_DEFINES,RD_JAVA_S60_RELEASE_10_1_ONWARDS) {
-
- }
- else {
- LIBS += -lwebutils
- }
+ LIBS += -leuser -lhttp -lecom -lbafl -linetprotutil -lhttpfiltercommon -lx509 -lx500 -lcrypto -lesock -lcommdb -lcentralrepository -lwebutils
contains(PROJECT_DEFINES,RD_JAVA_S60_RELEASE_5_0) {
LIBS += -lcommdb
--- a/javacommons/gcfprotocols/http/inc.s60/javauseragent.h Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef GETUSERAGENT_H
-#define GETUSERAGENT_H
-
-#include <e32base.h>
-
-class JavaUserAgent
-{
-
-public:
- static HBufC* GetUserAgentL();
-
-};
-
-#endif /* GETUSERAGENT_H */
--- a/javacommons/gcfprotocols/http/src.s60/javauseragent.cpp Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "javauseragent.h"
-#ifdef RD_JAVA_S60_RELEASE_10_1_ONWARDS
-#else
-#include <cuseragent.h>
-#endif
-
-
-
-HBufC* JavaUserAgent::GetUserAgentL()
-{
-#ifdef RD_JAVA_S60_RELEASE_10_1_ONWARDS
-
- _LIT(KString,"null");
- HBufC* agent = HBufC::NewLC(5);
- *agent = KString;
- CleanupStack::Pop(agent);
- return agent;
-
-#else
-
- CUserAgent* userAgent = CUserAgent::NewL();
- CleanupStack::PushL(userAgent);
-
- HBufC8* agent8 = userAgent->UserAgentL();
- CleanupStack::PushL(agent8);
-
- HBufC* agent = HBufC::NewMaxLC(agent8->Length());
- agent->Des().Copy(*agent8);
-
- CleanupStack::Pop(agent);
- CleanupStack::PopAndDestroy(agent8);
- CleanupStack::PopAndDestroy(userAgent);
- return agent;
-#endif
-}
--- a/javacommons/gcfprotocols/http/src.s60/nativetransaction.cpp Fri Jul 23 12:27:20 2010 +0300
+++ b/javacommons/gcfprotocols/http/src.s60/nativetransaction.cpp Thu Aug 05 16:07:57 2010 +0300
@@ -19,13 +19,18 @@
#include <e32def.h>
#include <centralrepository.h>
+#ifdef RD_JAVA_S60_RELEASE_10_1_ONWARDS
+#include <cuseragent.h>
+#else
+#include <cuseragent.h>
+#endif
+
#include "com_nokia_mj_impl_http_HttpConnectionNative.h"
#include "nativehttptransaction.h"
#include "nativehttpsession.h"
#include "monitor.h"
#include "logger.h"
#include "s60commonutils.h"
-#include "javauseragent.h"
using namespace java::util;
@@ -215,14 +220,23 @@
jstring GetUserAgentL(JNIEnv *aJni, jboolean aMidpRuntime)
{
- LOG(ESOCKET,EInfo,"GetUserAgentL() +");
jstring header = NULL;
if (aMidpRuntime == false)
{
- HBufC* stringBufPtr = JavaUserAgent::GetUserAgentL();
- header = S60CommonUtils::NativeToJavaString(*aJni,stringBufPtr->Des());
- delete stringBufPtr;
+ CUserAgent* userAgent = CUserAgent::NewL();
+ CleanupStack::PushL(userAgent);
+
+ HBufC8* agent8 = userAgent->UserAgentL();
+ CleanupStack::PushL(agent8);
+ HBufC* agent = HBufC::NewMaxLC(agent8->Length());
+ agent->Des().Copy(*agent8);
+ header = S60CommonUtils::NativeToJavaString(*aJni, agent->Des());
+
+ CleanupStack::PopAndDestroy(agent);
+ CleanupStack::PopAndDestroy(agent8);
+ CleanupStack::PopAndDestroy(userAgent);
+
return header;
}
@@ -242,9 +256,18 @@
{
case KHTTPUserAgentBrowserHeader:
{
- HBufC* stringBufPtr = (JavaUserAgent::GetUserAgentL());
- header = S60CommonUtils::NativeToJavaString(*aJni, stringBufPtr->Des());
- delete stringBufPtr;
+ CUserAgent* userAgent = CUserAgent::NewL();
+ CleanupStack::PushL(userAgent);
+
+ HBufC8* agent8 = userAgent->UserAgentL();
+ CleanupStack::PushL(agent8);
+ HBufC* agent = HBufC::NewMaxLC(agent8->Length());
+ agent->Des().Copy(*agent8);
+ header = S60CommonUtils::NativeToJavaString(*aJni, agent->Des());
+
+ CleanupStack::PopAndDestroy(agent);
+ CleanupStack::PopAndDestroy(agent8);
+ CleanupStack::PopAndDestroy(userAgent);
}
break;
--- a/javacommons/javaenv/src.s60/javaenvinfo.cpp Fri Jul 23 12:27:20 2010 +0300
+++ b/javacommons/javaenv/src.s60/javaenvinfo.cpp Thu Aug 05 16:07:57 2010 +0300
@@ -113,7 +113,7 @@
{
JELOG2(EUtils);
- TInt size;
+ TInt size = 0;
RFs rfs;
User::LeaveIfError(rfs.Connect());
--- a/javacommons/security/data/att_untrusted.txt Fri Jul 23 12:27:20 2010 +0300
+++ b/javacommons/security/data/att_untrusted.txt Thu Aug 05 16:07:57 2010 +0300
@@ -2,4 +2,5 @@
grant user "Net Access" oneshot,no {
permission javax.microedition.io.HttpProtocolPermission "http://*";
permission javax.microedition.io.HttpsProtocolPermission "https://*";
+ permission javax.microedition.io.Connector.rtsp "*";
}
--- a/javacommons/security/src.s60/fileutils.cpp Fri Jul 23 12:27:20 2010 +0300
+++ b/javacommons/security/src.s60/fileutils.cpp Thu Aug 05 16:07:57 2010 +0300
@@ -65,7 +65,7 @@
if (err == KErrNone)
{
// figure out the size of the file
- TInt size;
+ TInt size = 0;
if (drmContent)
{
TRAP(err, cafData->DataSizeL(size));
--- a/javacommons/security/src/midpauthenticationmoduleimpl.cpp Fri Jul 23 12:27:20 2010 +0300
+++ b/javacommons/security/src/midpauthenticationmoduleimpl.cpp Thu Aug 05 16:07:57 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-
+#include "javacommonutils.h"
#include "javajniutils.h"
#include "com_nokia_mj_impl_security_midp_authentication_AuthenticationModule.h"
#include "midpauthenticationmodule.h"
@@ -473,11 +473,12 @@
{
ret_code = getErrCode(X509_STORE_CTX_get_error(x509_ctx));
// If the secure time of the device has not yet been set
- // (can happen some times during the first device boot),
+ // to correct value (This can happen some times during
+ // the first device boot),
// allow installing with not yet valid certificates
if (KCertNotYetValidFailure == ret_code)
{
- if (!TelUtils::isSecureTimeSet())
+ if (JavaCommonUtils::isFirstBoot())
{
ret_code = KCertAndSignatureOk;
}
--- a/javacommons/utils/build/bwins/javautilsu.def Fri Jul 23 12:27:20 2010 +0300
+++ b/javacommons/utils/build/bwins/javautilsu.def Thu Aug 05 16:07:57 2010 +0300
@@ -129,4 +129,6 @@
??1RuntimeException@runtime@java@@UAE@XZ @ 128 NONAME ; java::runtime::RuntimeException::~RuntimeException(void)
?toString@RuntimeException@runtime@java@@UBE?AV?$basic_string@DV?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ @ 129 NONAME ; class std::basic_string<char, class std::char_traits<char>, class std::allocator<char> > java::runtime::RuntimeException::toString(void) const
?wbase64encode@JavaCommonUtils@util@java@@SA?AV?$basic_string@_WV?$char_traits@_W@std@@V?$allocator@_W@2@@std@@ABV45@@Z @ 130 NONAME ; class std::basic_string<wchar_t, class std::char_traits<wchar_t>, class std::allocator<wchar_t> > java::util::JavaCommonUtils::wbase64encode(class std::basic_string<wchar_t, class std::char_traits<wchar_t>, class std::allocator<wchar_t> > const &)
+ ?isFirstBoot@JavaCommonUtils@util@java@@SA_NXZ @ 131 NONAME ; bool java::util::JavaCommonUtils::isFirstBoot(void)
+ ?initIsFirstBoot@JavaCommonUtils@util@java@@SAHXZ @ 132 NONAME ; int java::util::JavaCommonUtils::initIsFirstBoot(void)
--- a/javacommons/utils/build/eabi/javautilsu.def Fri Jul 23 12:27:20 2010 +0300
+++ b/javacommons/utils/build/eabi/javautilsu.def Thu Aug 05 16:07:57 2010 +0300
@@ -179,4 +179,6 @@
_ZTIN4java7runtime16RuntimeExceptionE @ 178 NONAME
_ZTVN4java7runtime16RuntimeExceptionE @ 179 NONAME
_ZN4java4util15JavaCommonUtils13wbase64encodeERKSbIwSt11char_traitsIwESaIwEE @ 180 NONAME
+ _ZN4java4util15JavaCommonUtils11isFirstBootEv @ 181 NONAME
+ _ZN4java4util15JavaCommonUtils15initIsFirstBootEv @ 182 NONAME
--- a/javacommons/utils/inc/javacommonutils.h Fri Jul 23 12:27:20 2010 +0300
+++ b/javacommons/utils/inc/javacommonutils.h Thu Aug 05 16:07:57 2010 +0300
@@ -122,6 +122,33 @@
*/
OS_IMPORT static std::wstring percentDecode(const std::wstring& str);
+ /**
+ * This function checks whether is it called during the first device boot
+ * and stores the information to static data so that isFirstBoot() can
+ * return it.
+ *
+ * Call this function always when the process is starting.
+ *
+ * This function creates a flag file to the private data cage / work directory
+ * of the process.
+ *
+ * In Symbian this method can be called only from Java Installer or
+ * Java MIDP processes.
+ *
+ * Return 0 if check was made successfully. Otherwise it returns errno
+ * defined in STDLIBS errno.h
+ */
+ OS_IMPORT static int initIsFirstBoot();
+
+ /**
+ * This function returns true if it called during the first boot.
+ * Otherwise it returns false.
+ *
+ * initIsFirstBoot() must be called before this function can be called.
+ */
+ OS_IMPORT static bool isFirstBoot();
+
+
public:
/**
* Decodes one %<X><Y> sequence.
@@ -131,6 +158,10 @@
* @throws ExceptionBase if <X> and <Y> are not hexadecimal characters
*/
static char decodeOnePercentSeq(wchar_t first, wchar_t sec);
+
+private:
+ static bool mFirstBoot;
+
};
// A simple class for storing char array that is deleted automatically
--- a/javacommons/utils/src/javacommonutils.cpp Fri Jul 23 12:27:20 2010 +0300
+++ b/javacommons/utils/src/javacommonutils.cpp Thu Aug 05 16:07:57 2010 +0300
@@ -15,9 +15,11 @@
*
*/
-
+#include <errno.h>
+#include <fcntl.h>
#include <iostream>
#include <sstream>
+#include <unistd.h>
#include <vector>
#include <string.h>
@@ -33,6 +35,16 @@
using namespace java::util;
+// In Symbian working directory should be initalized to C:\private\<UID> by OpenC
+// But for some reason this does not seem to work if process binary is in rom.
+#ifdef __SYMBIAN32__
+const char* const FIRST_BOOT_FILE = "c:\\private\\102033E6\\first_boot_done.dat";
+#else
+const char* const FIRST_BOOT_FILE = "first_boot_done.dat";
+#endif /* __SYMBIAN32__ */
+
+bool JavaCommonUtils::mFirstBoot = false;
+
OS_EXPORT int JavaCommonUtils::stringToInt(const std::string& str)
{
// JELOG2(EUtils);
@@ -372,6 +384,40 @@
}
+OS_EXPORT int JavaCommonUtils::initIsFirstBoot()
+{
+ struct stat fileStatBuf;
+ if (stat(FIRST_BOOT_FILE, &fileStatBuf) == 0)
+ {
+ mFirstBoot = false;
+ }
+ else
+ {
+ mFirstBoot = true;
+
+ // Create flag file so that next time we detect that first boot
+ // has already been done
+ int fd = open(FIRST_BOOT_FILE, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
+ if (fd < 0)
+ {
+ return errno;
+ }
+ else
+ {
+ close(fd);
+ }
+ }
+
+ return 0;
+}
+
+
+OS_EXPORT bool JavaCommonUtils::isFirstBoot()
+{
+ return mFirstBoot;
+}
+
+
char JavaCommonUtils::decodeOnePercentSeq(wchar_t first, wchar_t sec)
{
// Handle one encoded %XY
--- a/javaextensions/bluetooth/bluetoothcommons/bluetoothplatformcontrol/src.s60/s60btdialog.cpp Fri Jul 23 12:27:20 2010 +0300
+++ b/javaextensions/bluetooth/bluetoothcommons/bluetoothplatformcontrol/src.s60/s60btdialog.cpp Thu Aug 05 16:07:57 2010 +0300
@@ -23,6 +23,13 @@
#include "s60btdialog.h"
#include "logger.h"
+#ifdef RD_JAVA_S60_RELEASE_10_1_ONWARDS
+#include <hbdevicemessageboxsymbian.h>
+#include <hbpopup.h>
+#include <QtCore\qvariant.h>
+
+#define QUERY_BUF_LEN 512
+#endif
using namespace java::bluetooth;
@@ -44,7 +51,9 @@
void CS60BTDialog::ConstructL()
{
LOG(EJavaBluetooth, EInfo, "+ CS60BTDialog::ConstructL()");
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
User::LeaveIfError(mNotifier.Connect());
+#endif
LOG(EJavaBluetooth, EInfo, "- CS60BTDialog::ConstructL()");
}
@@ -57,7 +66,9 @@
{
CS60BTDialog* self = new(ELeave) CS60BTDialog;
CleanupStack::PushL(self);
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
self->ConstructL();
+#endif
return self;
}
@@ -70,8 +81,11 @@
{
JELOG2(EJavaBluetooth);
LOG(EJavaBluetooth, EInfo, "+ CS60BTDialog::~CS60BTDialog()");
+
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
DoCancel();
mNotifier.Close();
+#endif
LOG(EJavaBluetooth, EInfo, "- CS60BTDialog::~CS60BTDialog()");
}
@@ -87,13 +101,41 @@
JELOG2(EJavaBluetooth);
LOG1(EJavaBluetooth, EInfo,"+ CS60BTDialog::ShowBTQueryDialog(): aQueryType = %d", aQueryType);
+
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
mQueryParamsPckg().iMessageType = aQueryType;
mQueryParamsPckg().iNameExists = ETrue;
mQueryParamsPckg().iName.Copy(aAppName);
mNotifier.StartNotifierAndGetResponse(mStatus, KBTGenericQueryNotifierUid,
mQueryParamsPckg, mQueryResult);
+ User::WaitForRequest(mStatus);
- User::WaitForRequest(mStatus);
+#else
+ _LIT(KAppInfo,"Application %S cannot be used when Bluetooth is off Activate Bluetooth ?");
+ _LIT(KAppInfomsg,"Change 'My phone's visibility' setting to 'Show to all'? Application '%S' cannot be used when the visibility is set as 'Hidden'.");
+
+ TBuf<QUERY_BUF_LEN> queryBuf;
+ TInt err = KErrNone;
+ TBool userOpt;
+
+ queryBuf.Zero();
+ if (aQueryType == EBTIsOffJavaQuery)
+ {
+ queryBuf.Format(KAppInfo,&aAppName);
+ }
+ else if (aQueryType == EBTIsNotShownQuery)
+ {
+ queryBuf.Format(KAppInfomsg,&aAppName);
+ }
+
+ TRAP(err, userOpt = ShowBTQueryHbDialogL(queryBuf));
+ LOG1(EJavaBluetooth, EInfo," CS60BTDialog::ShowBTQueryDialog(): mQueryResult = %d", err);
+
+ if (err != KErrNone )
+ mQueryResult = EFalse;
+ else
+ mQueryResult = userOpt;
+#endif
LOG1(EJavaBluetooth, EInfo,"- CS60BTDialog::ShowBTQueryDialog(): mQueryResult = %d", mQueryResult());
return mQueryResult();
@@ -109,6 +151,42 @@
void CS60BTDialog::DoCancel()
{
LOG(EJavaBluetooth, EInfo, "+ CS60BTDialog::DoCancel()");
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
mNotifier.CancelNotifier(KBTGenericQueryNotifierUid);
+#endif
LOG(EJavaBluetooth, EInfo, "- CS60BTDialog::DoCancel()");
}
+
+#ifdef RD_JAVA_S60_RELEASE_10_1_ONWARDS
+
+TBool CS60BTDialog::ShowBTQueryHbDialogL(const TDesC& aBufData)
+{
+ TBool result = EFalse;
+
+ CHbDeviceMessageBoxSymbian* messageBox
+ = CHbDeviceMessageBoxSymbian::NewL(CHbDeviceMessageBoxSymbian::EQuestion);
+ CleanupStack::PushL(messageBox);
+
+ messageBox->SetTextL(aBufData);
+ messageBox->SetTimeout(HbPopup::NoTimeout);
+
+ // Read localised versions instead of hard coded values.
+ _LIT(KAllowButtonText, "Yes");
+ _LIT(KDenyButtonText, "No");
+
+ messageBox->SetButtonTextL(CHbDeviceMessageBoxSymbian::EAcceptButton, KAllowButtonText);
+ messageBox->SetButton(CHbDeviceMessageBoxSymbian::EAcceptButton, ETrue);
+ messageBox->SetButtonTextL(CHbDeviceMessageBoxSymbian::ERejectButton, KDenyButtonText);
+ messageBox->SetButton(CHbDeviceMessageBoxSymbian::ERejectButton, ETrue);
+
+ if (messageBox->ExecL() == CHbDeviceMessageBoxSymbian::EAcceptButton)
+ result = ETrue;
+ else
+ result = EFalse;
+
+ messageBox->Close();
+ CleanupStack::PopAndDestroy(messageBox);
+
+ return result;
+}
+#endif
--- a/javaextensions/bluetooth/bluetoothcommons/bluetoothplatformcontrol/src.s60/s60btdialog.h Fri Jul 23 12:27:20 2010 +0300
+++ b/javaextensions/bluetooth/bluetoothcommons/bluetoothplatformcontrol/src.s60/s60btdialog.h Thu Aug 05 16:07:57 2010 +0300
@@ -57,6 +57,11 @@
TBool ShowBTQueryDialog(const TDesC& aAppName, const TBool aInstalling,
TBTGenericQueryNoteType aQueryType);
+#ifdef RD_JAVA_S60_RELEASE_10_1_ONWARDS
+ TBool ShowBTQueryHbDialogL(const TDesC& aBufData);
+#endif
+
+
/**
* Cancels the asynchronous request to the query list dialog.
*
@@ -72,7 +77,9 @@
private: // data
TRequestStatus mStatus;
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
RNotifier mNotifier;
+#endif
TBTGenericQueryNotiferParamsPckg mQueryParamsPckg;
TPckgBuf<TBool> mQueryResult;
};
--- a/javaextensions/bluetooth/bluetoothcommons/build/javabluetoothcommons.pro Fri Jul 23 12:27:20 2010 +0300
+++ b/javaextensions/bluetooth/bluetoothcommons/build/javabluetoothcommons.pro Thu Aug 05 16:07:57 2010 +0300
@@ -14,20 +14,33 @@
# Description:
#
+include(../../../../inc/build_defines.pri)
+
TEMPLATE=lib
TARGET=javabluetoothcommons
CONFIG += omj java stl
-CONFIG -= qt
-symbian {
+contains(PROJECT_DEFINES,RD_JAVA_S60_RELEASE_5_0) {
+ CONFIG -= qt
+}
+contains(PROJECT_DEFINES,RD_JAVA_S60_RELEASE_9_2) {
+ CONFIG -= qt
+}
+contains(PROJECT_DEFINES,RD_JAVA_S60_RELEASE_10_1_ONWARDS) {
+ CONFIG += hb
+}
+
+
+symbian {
SOURCES += ../src/*.cpp
SOURCES += ../src.s60/*.cpp
SOURCES += ../bluetoothplatformcontrol/src/*.cpp
- SOURCES += ../bluetoothplatformcontrol/src.s60/*.cpp
+ SOURCES += ../bluetoothplatformcontrol/src.s60/*.cpp
}
LIBS += -lsdpdatabase -lbtengsettings -lbluetooth -lbtmanclient \
-lbtdevice -ljavacomms -ljavafileutils -lesock
+include(../../../../build/omj.pri)
-include(../../../../build/omj.pri)
+
--- a/javaextensions/bluetooth/bluetoothcommons/src.s60/bluetoothnamelookup.cpp Fri Jul 23 12:27:20 2010 +0300
+++ b/javaextensions/bluetooth/bluetoothcommons/src.s60/bluetoothnamelookup.cpp Thu Aug 05 16:07:57 2010 +0300
@@ -63,9 +63,8 @@
mLookupMonitor = new CActiveSchedulerWait();
}
LOG1(EJavaBluetooth, EInfo,
- "+ BluetoothNameLookup::doDeviceNameLookupL DeviceAddress:%x",
+ "+ BluetoothNameLookup::doDeviceNameLookupL DeviceAddress:%llx",
aDevAddr);
-
TProtocolDesc pdesc;
User::LeaveIfError(mSocketServ.FindProtocol(KBTLinkManagerTxt(), pdesc));
--- a/javaextensions/bluetooth/bluetoothplugins/btl2cappushplugin/src.s60/btl2capserverconnection.cpp Fri Jul 23 12:27:20 2010 +0300
+++ b/javaextensions/bluetooth/bluetoothplugins/btl2cappushplugin/src.s60/btl2capserverconnection.cpp Thu Aug 05 16:07:57 2010 +0300
@@ -489,7 +489,21 @@
if (KErrNone == err)
{
mAcceptedSocket->RemoteName(btRemoteAddr);
- if (mAsyncAccept && (!mAvoidFilter) && (false == isConnectionAllowed(btRemoteAddr)))
+ TBuf<20> addr;
+ TInt64 longBtAddr = 0;
+ TBTDevAddr btDeviceAddress = btRemoteAddr.BTAddr();
+ LOG4(EJavaBluetooth,EInfo,"TBTDevAddr Address is %x %x %x %x ",
+ btDeviceAddress[0],btDeviceAddress[1],
+ btDeviceAddress[2],btDeviceAddress[3]);
+ LOG2(EJavaBluetooth,EInfo,"%x %x",btDeviceAddress[4],
+ btDeviceAddress[5]);
+ btDeviceAddress.GetReadable(addr);
+ LOG1(EJavaBluetooth,EInfo,"BT: Readable address is %S",&addr);
+ TLex16 toParse(addr);
+ toParse.Val(longBtAddr, EHex);
+ LOG1(EJavaBluetooth, EInfo,
+ "L2CAPServerConnection::HandleAcceptCompleteL: Address: %llx", longBtAddr);
+ if ((longBtAddr == 0) ||(mAsyncAccept && (!mAvoidFilter) && (false == isConnectionAllowed(btRemoteAddr))))
{
mAcceptedSocket->CancelAll();
mAcceptedSocket->Shutdown(RSocket::EImmediate);
@@ -500,14 +514,7 @@
AcceptL();
return;
}
- TBuf<20> addr;
- TInt64 longBtAddr = 0;
- TBTDevAddr btDeviceAddress = btRemoteAddr.BTAddr();
- btDeviceAddress.GetReadable(addr);
- TLex16 toParse(addr);
- toParse.Val(longBtAddr, EHex);
- LOG1(EJavaBluetooth, EInfo,
- "L2CAPServerConnection::HandleAcceptCompleteL: Address: %ld", longBtAddr);
+
mBtClientConn = new BluetoothClientConnection(mAcceptedSocket, mServer);
mAcceptedSocket->GetOpt(KL2CAPInboundMTU, KSolBtL2CAP, negotiatedReceiveMtu);
mAcceptedSocket->GetOpt(KL2CAPNegotiatedOutboundMTU, KSolBtL2CAP, negotiatedTransmitMtu);
--- a/javaextensions/bluetooth/bluetoothplugins/btl2cappushplugin/src/btl2cappushserverconnection.cpp Fri Jul 23 12:27:20 2010 +0300
+++ b/javaextensions/bluetooth/bluetoothplugins/btl2cappushplugin/src/btl2cappushserverconnection.cpp Thu Aug 05 16:07:57 2010 +0300
@@ -199,7 +199,9 @@
BluetoothNameLookup * nameLookup = NULL;
long long remoteDevAddr = aClientConnection->getRemoteAddress();
-
+ ELOG1(EJavaBluetooth,
+ "+ L2CapPushServerConnection::handleConnectionRequest DeviceAddress:%llx",
+ remoteDevAddr);
TRAPD(lookupErr,
{
nameLookup = BluetoothNameLookup::NewL();
--- a/javaextensions/bluetooth/bluetoothplugins/btspppushplugin/src.s60/btrfcommserverconnection.cpp Fri Jul 23 12:27:20 2010 +0300
+++ b/javaextensions/bluetooth/bluetoothplugins/btspppushplugin/src.s60/btrfcommserverconnection.cpp Thu Aug 05 16:07:57 2010 +0300
@@ -437,7 +437,21 @@
if (KErrNone == err)
{
mAcceptedSocket->RemoteName(btRemoteAddr);
- if (mAsyncAccept && (!mAvoidFilter) && (false == isConnectionAllowed(btRemoteAddr)))
+ TBuf<20> addr;
+ TInt64 longBtAddr = 0;
+ TBTDevAddr btDeviceAddress = btRemoteAddr.BTAddr();
+ LOG4(EJavaBluetooth,EInfo,"TBTDevAddr Address is %x %x %x %x ",
+ btDeviceAddress[0],btDeviceAddress[1],
+ btDeviceAddress[2],btDeviceAddress[3]);
+ LOG2(EJavaBluetooth,EInfo,"%x %x",btDeviceAddress[4],
+ btDeviceAddress[5]);
+ btDeviceAddress.GetReadable(addr);
+ LOG1(EJavaBluetooth,EInfo,"BT: Readable address is %S",&addr);
+ TLex16 toParse(addr);
+ toParse.Val(longBtAddr, EHex);
+ LOG1(EJavaBluetooth, EInfo,
+ "L2CAPServerConnection::HandleAcceptCompleteL: Address: %llx", longBtAddr);
+ if ((longBtAddr == 0) ||(mAsyncAccept && (!mAvoidFilter) && (false == isConnectionAllowed(btRemoteAddr))))
{
mAcceptedSocket->CancelAll();
mAcceptedSocket->Shutdown(RSocket::EImmediate);
@@ -448,13 +462,7 @@
AcceptL();
return;
}
- TBuf<20> addr;
- TInt64 longBtAddr = 0;
- TBTDevAddr btDeviceAddress = btRemoteAddr.BTAddr();
- btDeviceAddress.GetReadable(addr);
- TLex16 toParse(addr);
- toParse.Val(longBtAddr, EHex);
- LOG1(EJavaBluetooth, EInfo, "RFCOMMServerConnection::HandleAcceptCompleteL: Address: %ld", longBtAddr);
+
mBtClientConn = new BluetoothClientConnection(mAcceptedSocket, mServer);
mBtClientConn->initialize(PROTOCOL_RFCOMM, longBtAddr, 0, 0);
if (mAsyncAccept)
--- a/javaextensions/bluetooth/omjbluetooth/javasrc/com/nokia/mj/impl/properties/bluetooth/BtDynamicPropertyHandler.java Fri Jul 23 12:27:20 2010 +0300
+++ b/javaextensions/bluetooth/omjbluetooth/javasrc/com/nokia/mj/impl/properties/bluetooth/BtDynamicPropertyHandler.java Thu Aug 05 16:07:57 2010 +0300
@@ -65,7 +65,7 @@
private static final int MASTER_SWITCH = 7;
- private static final int SD_TRANS_MAX = 8;
+ private static final int SD_TRANS_MAX = 1;
private static final int SD_ATTR_RETRIEVE_MAX = 9;
--- a/javaextensions/satsa/build/javasatsa.pro Fri Jul 23 12:27:20 2010 +0300
+++ b/javaextensions/satsa/build/javasatsa.pro Thu Aug 05 16:07:57 2010 +0300
@@ -11,33 +11,47 @@
#
# Contributors:
#
-# Description:
+# Description:
#
+include(../../../inc/build_defines.pri)
+
TARGET=javasatsa
TEMPLATE=lib
-CONFIG += omj java stl
-CONFIG -= qt
+CONFIG += omj java stl
+
+contains(PROJECT_DEFINES,RD_JAVA_S60_RELEASE_5_0) {
+ CONFIG -= qt
+}
+contains(PROJECT_DEFINES,RD_JAVA_S60_RELEASE_9_2) {
+ CONFIG -= qt
+}
+contains(PROJECT_DEFINES,RD_JAVA_S60_RELEASE_10_1_ONWARDS) {
+ CONFIG += hb
+}
symbian {
+
+
INCLUDEPATH += ../framework/inc \
../pki/inc \
../apdu/inc \
../../inc \
../../../inc \
-
-
+
+
+
SOURCES += ../pki/src.s60/*.cpp \
../crypto/src/*.cpp \
../apdu/src/*.cpp \
../apdu/src.s60/*.cpp \
../framework/src/satsajnitools.cpp \
-
-
+
+
LIBS += -ljavastorage \
-lCommonUI \
-lrandom \
- -lx509 \
+ -lx509 \
-lx500 \
-llibcrypto \
-lasn1 \
@@ -51,7 +65,7 @@
-laknnotify \
-leiksrv \
-lctframework \
- -lctsecdlgs \
+ -lctsecdlgs \
-lcustomapi \
-lefsrv \
-letel \
@@ -61,10 +75,9 @@
-lhash \
-lWimClient \
-lestlib \
- -lcryptography \
-
-
-
+ -lcryptography \
+
+
}
include(../../../build/omj.pri)
--- a/javaextensions/satsa/pki/src.s60/cstsseprompt.cpp Fri Jul 23 12:27:20 2010 +0300
+++ b/javaextensions/satsa/pki/src.s60/cstsseprompt.cpp Thu Aug 05 16:07:57 2010 +0300
@@ -18,11 +18,24 @@
// INCLUDE FILES
+
+
+
#include "cstsseprompt.h"
+
+#ifdef RD_JAVA_S60_RELEASE_10_1_ONWARDS
+
+#include <hbdevicedialog.h>
+#include <QtCore\qvariant.h>
+const QString KMessageTextKey = "text";
+
+#else
+
#include <AknGlobalNote.h>
#include <avkon.rsg>
#include <caosynchronizer.h>
+#endif
// ============================ MEMBER FUNCTIONS ===============================
@@ -43,8 +56,10 @@
// Destructor
CSTSSEPrompt::~CSTSSEPrompt()
{
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
delete iGlobalNote;
delete iSynchronizer;
+#endif
}
// -----------------------------------------------------------------------------
@@ -54,11 +69,26 @@
//
void CSTSSEPrompt::DisplayPromptL(const TDesC& aPrompt)
{
+ #ifdef RD_JAVA_S60_RELEASE_10_1_ONWARDS
+ HbDeviceDialog* dialog;
+ dialog = new(ELeave) HbDeviceDialog();
+
+ QVariantMap parameters;
+ QString qString((QChar*)aPrompt.Ptr(),aPrompt.Length());
+ parameters[QString(KMessageTextKey)] = qString;
+
+ dialog->show("com.nokia.hb.devicemessagebox/1.0", parameters);
+
+ delete dialog;
+ #else
+
iGlobalNote->ShowNoteL(
iSynchronizer->iStatus,
- EAknGlobalConfirmationNote,
+ EAknGlobalConfirmationNote,
aPrompt);
iSynchronizer->ExecuteL((TTimeIntervalMicroSeconds32) 0);
+
+ #endif
}
// -----------------------------------------------------------------------------
@@ -77,9 +107,11 @@
// -----------------------------------------------------------------------------
void CSTSSEPrompt::ConstructL()
{
+ #ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
iGlobalNote = CAknGlobalNote::NewL();
iGlobalNote->SetSoftkeys(R_AVKON_SOFTKEYS_OK_EMPTY);
iSynchronizer = CAOSynchronizer::NewL();
+ #endif
}
--- a/javaextensions/satsa/pki/src.s60/cstsseprompt.h Fri Jul 23 12:27:20 2010 +0300
+++ b/javaextensions/satsa/pki/src.s60/cstsseprompt.h Thu Aug 05 16:07:57 2010 +0300
@@ -22,13 +22,13 @@
// INCLUDE
#include <e32base.h>
-
-
+// FORWARD DECLARATIONS
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
-// FORWARD DECLARATIONS
+class CAOSynchronizer;
class CAknGlobalNote;
-class CAOSynchronizer;
+#endif
// CLASS DECLARATION
/**
@@ -71,11 +71,14 @@
private: // data
-
+ #ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
// displays the prompt asynchronously, owned
CAknGlobalNote* iGlobalNote;
// waits for the prompt to finish, owned
CAOSynchronizer* iSynchronizer;
+
+ #endif
+
};
--- a/javamanager/javainstaller/installer/src.s60/iconconverter/iconconverter.cpp Fri Jul 23 12:27:20 2010 +0300
+++ b/javamanager/javainstaller/installer/src.s60/iconconverter/iconconverter.cpp Thu Aug 05 16:07:57 2010 +0300
@@ -20,7 +20,7 @@
#include <zipfile.h>
#include <time.h>
-#include <BitmapTransforms.h>
+#include <bitmaptransforms.h>
#include "javacommonutils.h"
#include "logger.h"
--- a/javamanager/javainstaller/installer/src.s60/jadjarmatcher/jadjarmatcher.cpp Fri Jul 23 12:27:20 2010 +0300
+++ b/javamanager/javainstaller/installer/src.s60/jadjarmatcher/jadjarmatcher.cpp Thu Aug 05 16:07:57 2010 +0300
@@ -83,7 +83,7 @@
classHandles, "addElement", "(Ljava/lang/Object;)V");
jclass classTimestamps = aEnv->GetObjectClass(aTimestamps);
jmethodID methodTimestampsAddElement = aEnv->GetMethodID(
- classHandles, "addElement", "(Ljava/lang/Object;)V");
+ classTimestamps, "addElement", "(Ljava/lang/Object;)V");
jclass integerClass = aEnv->FindClass("java/lang/Integer");
jmethodID integerConstructor = aEnv->GetMethodID(
integerClass, "<init>", "(I)V");
--- a/javamanager/javarecognizer/src/recjar.cpp Fri Jul 23 12:27:20 2010 +0300
+++ b/javamanager/javarecognizer/src/recjar.cpp Thu Aug 05 16:07:57 2010 +0300
@@ -100,7 +100,7 @@
weOwnFileHandle = ETrue;
}
- TInt fileRemaining;
+ TInt fileRemaining = 0;
User::LeaveIfError(file->Size(fileRemaining));
if (fileRemaining > aBuffer.Length())
{
--- a/javaruntimes/installer/starterdll/src/main.cpp Fri Jul 23 12:27:20 2010 +0300
+++ b/javaruntimes/installer/starterdll/src/main.cpp Thu Aug 05 16:07:57 2010 +0300
@@ -149,6 +149,15 @@
return INSTALLER_ALREADY_RUNNING;
}
+ // Check whether executing this process during first boot.
+ ret = JavaCommonUtils::initIsFirstBoot();
+ if (0 != ret)
+ {
+ ELOG1(EJavaRuntime,
+ "INSTALLER main() Cannot create first_boot_done.dat flag file, errno.h err %d",
+ ret);
+ }
+
int result = -1;
try
{
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/graphics/Image.java Fri Jul 23 12:27:20 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/graphics/Image.java Thu Aug 05 16:07:57 2010 +0300
@@ -73,44 +73,6 @@
* @see ImageLoader
*/
public final class Image implements Drawable {
-
- static int getNullIconHandle() {
- if( Device.nullIconHandle == 0 ){
- Device.nullIconHandle = OS.QIcon_new();
- }
- return Device.nullIconHandle;
- }
-
- /*
- * Creates new Image instance.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>Image</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is not
- * available on all platforms, and should never be called from
- * application code.
- * </p>
- * @param device the device on which to create the image
- * @param cgImage the internal image instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if device is null and there is no current device</li>
- * <li>ERROR_NULL_ARGUMENT - if the iternal image is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_INVALID_IMAGE - if the given internal image is not valid</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_NO_HANDLES if a handle could not be obtained for image creation</li>
- * </ul>
- */
- static Image new_Image(
- Device device, org.eclipse.swt.internal.qt.graphics.Image cgImage) {
- Image image = new Image(device);
- image.init(cgImage);
- return image;
- }
-
/**
* specifies whether the receiver is a bitmap or an icon
* (one of <code>SWT.BITMAP</code>, <code>SWT.ICON</code>)
@@ -368,7 +330,7 @@
*/
public Image(Device device, String filename) {
this(device, filename, true);
- }
+ }
private Image(Device device, String filename, boolean securityCheck) {
this(device);
@@ -859,4 +821,41 @@
private void track() {
if (Device.tracking) device.new_Object(this);
}
+
+ static int getNullIconHandle() {
+ if( Device.nullIconHandle == 0 ){
+ Device.nullIconHandle = OS.QIcon_new();
+ }
+ return Device.nullIconHandle;
+ }
+
+ /**
+ * Creates new Image instance.
+ * <p>
+ * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
+ * API for <code>Image</code>. It is marked public only so that it
+ * can be shared within the packages provided by SWT. It is not
+ * available on all platforms, and should never be called from
+ * application code.
+ * </p>
+ * @param device the device on which to create the image
+ * @param cgImage the internal image instance
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if device is null and there is no current device</li>
+ * <li>ERROR_NULL_ARGUMENT - if the iternal image is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_INVALID_IMAGE - if the given internal image is not valid</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_NO_HANDLES if a handle could not be obtained for image creation</li>
+ * </ul>
+ */
+ static Image qt_new(
+ Device device, org.eclipse.swt.internal.qt.graphics.Image cgImage) {
+ Image image = new Image(device);
+ image.init(cgImage);
+ return image;
+ }
}
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Label.java Fri Jul 23 12:27:20 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Label.java Thu Aug 05 16:07:57 2010 +0300
@@ -127,10 +127,11 @@
}
checkWidget();
+
if (changed) {
OS.QWidget_updateGeometry(handle);
}
-
+
/**
* ComputeSize in super class is not able to handle the situation that
* preferred height depends on the width. So ask QLabel for preferred
@@ -167,6 +168,7 @@
else
height = defaultLength;
}
+
return new Point(width, height);
}
@@ -329,6 +331,25 @@
OS.QPixmap_delete(pixmapHandle);
}
}
+
+ void setThemeIcon(String name) {
+ checkWidget();
+ if ((style & SWT.SEPARATOR) != 0)
+ return;
+ int iconHandle = 0;
+ int pixmapHandle = 0;
+ try {
+ iconHandle = OS.HbIcon_new(name);
+ if (iconHandle != 0)
+ pixmapHandle = OS.HbIcon_pixmap(iconHandle);
+ if (pixmapHandle != 0)
+ OS.QLabel_setPixmap(topHandle, pixmapHandle);
+ } finally {
+ OS.HbIcon_delete(iconHandle);
+ OS.QPixmap_delete(pixmapHandle);
+ }
+ }
+
void setStyle(int style) {
int qStyle = 0;
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/gfxos.cpp Fri Jul 23 12:27:20 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/gfxos.cpp Thu Aug 05 16:07:57 2010 +0300
@@ -967,6 +967,21 @@
return POINTER_TO_HANDLE(img);
}
+jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_image_1create__I
+ (JNIEnv* aJniEnv , jclass, jint aPixmapHandle)
+{
+ Image* img = NULL;
+ GFX_TRY
+ {
+ SWT_LOG_JNI_CALL();
+ HANDLE_TO_POINTER(QPixmap*, pixmap, aPixmapHandle);
+ if (pixmap)
+ img = GraphicsFactory::createImage(*pixmap);
+ }
+ GFX_CATCH
+ return POINTER_TO_HANDLE(img);
+}
+
jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_image_1getFormat
(JNIEnv* aJniEnv, jclass, jint aImageHandle)
{
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/graphics.h Fri Jul 23 12:27:20 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/graphics.h Thu Aug 05 16:07:57 2010 +0300
@@ -1675,6 +1675,13 @@
static Image* createImage(const QImage& aImage);
/**
+ * Create image from a QPixmap.
+ *
+ * @param aImage The source QPixmap
+ */
+ static Image* createImage(const QPixmap& aPixmap);
+
+ /**
* Creates an image based on the given ARGB data array.
* @param aRgbData ARGB data array. One pixel is specified as 0xAARRGGBB.
* @param aWidth Image width
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/graphicsfactory.cpp Fri Jul 23 12:27:20 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/graphicsfactory.cpp Thu Aug 05 16:07:57 2010 +0300
@@ -78,6 +78,14 @@
return static_cast<Image*>(pixmap);
}
+/*static*/ Image* GraphicsFactory::createImage(const QPixmap& aPixmap)
+{
+ GFX_LOG_FUNC_CALL();
+ Pixmap* pixmap = new Pixmap();
+ pixmap->createFromQPixmap(aPixmap);
+ return static_cast<Image*>(pixmap);
+}
+
/*static*/ Image* GraphicsFactory::createImage(int* aRgbData, int aWidth, int aHeight, bool aHasAlpha)
{
Pixmap* pixmap = new Pixmap();
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/qt/pixmap.cpp Fri Jul 23 12:27:20 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/qt/pixmap.cpp Thu Aug 05 16:07:57 2010 +0300
@@ -60,6 +60,19 @@
}
}
+void Pixmap::createFromQPixmap(const QPixmap& aPixmap)
+{
+ GFX_LOG_FUNC_CALL();
+ Q_ASSERT(mPixmap.isNull());
+
+ mPixmap = QPixmap(aPixmap);
+
+ // Validate allocation
+ if(mPixmap.isNull())
+ {
+ throw GfxException(EGfxErrorNoMemory, "Image (Pixmap) creation failed");
+ }
+}
void Pixmap::createFromImage(Image* aImage, int aX, int aY, int aWidth, int aHeight)
{
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/qt/pixmap.h Fri Jul 23 12:27:20 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/qt/pixmap.h Thu Aug 05 16:07:57 2010 +0300
@@ -35,6 +35,7 @@
*/
virtual void createBySize(int aWidth, int aHeight, int aFillColor, TImageFormat aFormat);
virtual void createFromQImage(const QImage& aImage);
+ virtual void createFromQPixmap(const QPixmap& aPixmap);
virtual void createFromImage(Image* aImage, int aX, int aY, int aWidth, int aHeight);
virtual void createFromImageData(ImageDataWrapper* aData);
virtual void createFromRGB(int* aRgbdata, int aWidth, int aHeight, bool aHasAlpha);
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/os.cpp Fri Jul 23 12:27:20 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/os.cpp Thu Aug 05 16:07:57 2010 +0300
@@ -86,6 +86,7 @@
#include <qnetworkconfigmanager.h>
#include <qnetworkconfiguration.h>
#include <hbinputsettingproxy.h>
+#include <hbicon.h>
#endif
#include <org_eclipse_swt_internal_qt_OS.h>
@@ -6343,7 +6344,60 @@
return reinterpret_cast< jint >(pixmap);
}
-
+//
+// HbIcon
+//
+
+JNIEXPORT jint JNICALL OS_NATIVE ( HbIcon_1new )
+ (JNIEnv* aJniEnv , jclass, jstring aName)
+ {
+#ifdef __SYMBIAN32__
+ HbIcon* icon = NULL;
+ SWT_TRY
+ {
+ SWT_LOG_JNI_CALL();
+ icon = new HbIcon(swtApp->jniUtils().JavaStringToQString(aJniEnv, aName));
+ }
+ SWT_CATCH
+ return reinterpret_cast< jint >( static_cast< HbIcon* >( icon ) );
+#else
+ return 0;
+#endif
+ }
+
+JNIEXPORT jint JNICALL OS_NATIVE( HbIcon_1pixmap )
+ (JNIEnv* aJniEnv , jclass, jint aHandle)
+ {
+#ifdef __SYMBIAN32__
+ QPixmap* pixmap = NULL;
+ SWT_TRY
+ {
+ SWT_LOG_JNI_CALL();
+ HbIcon* icon = reinterpret_cast< HbIcon* >( aHandle );
+ pixmap = new QPixmap(icon->pixmap());
+ }
+ SWT_CATCH
+ return reinterpret_cast< jint >(pixmap);
+#else
+ return 0;
+#endif
+ }
+
+JNIEXPORT void JNICALL OS_NATIVE( HbIcon_1delete )
+ (JNIEnv* aJniEnv , jclass, jint aHandle)
+ {
+#ifdef __SYMBIAN32__
+ SWT_TRY
+ {
+ SWT_LOG_JNI_CALL();
+ SWT_LOG_DATA_1("handle=%x", aHandle);
+ HbIcon* icon = reinterpret_cast< HbIcon* >( aHandle );
+ delete icon;
+ icon = NULL;
+ }
+ SWT_CATCH
+#endif
+ }
//
// QSlider
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/graphics/Internal_GfxPackageSupport.java Fri Jul 23 12:27:20 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/graphics/Internal_GfxPackageSupport.java Thu Aug 05 16:07:57 2010 +0300
@@ -26,41 +26,28 @@
public static int getNullIconHandle() {
return Image.getNullIconHandle();
}
-public static Image new_Image(Device device, org.eclipse.swt.internal.qt.graphics.Image cgImage) {
- return Image.new_Image(device, cgImage);
+
+public static Image new_Image(Device device,
+ org.eclipse.swt.internal.qt.graphics.Image cgImage) {
+ return Image.qt_new(device, cgImage);
}
+
public static int getIconHandle(Image i) {
return i.getIconHandle();
}
+
public static org.eclipse.swt.internal.qt.graphics.Image getImage(Image i) {
return i.getImage();
}
+
public static int getImageHandle(Image i) {
return i.getImageHandle();
}
+
public static int getPixmapHandle(Image i) {
return i.getPixmapHandle();
}
-/*
- * From the class Device
- */
-public static boolean internal(Device d) {
- return d.internal;
-}
-public static boolean initialized() {
- return Device.initialized;
-}
-public static Color newColor(Device device, int handle) {
- return Color.qt_new(device, handle);
-}
-public static Font newFont(Device device, int handle) {
- return Font.qt_new(device, handle);
-}
-
-/*
- * From the class Image
- */
public static Image createImageWithoutSecurityCheck(Device device,
String filename) {
return Image.createImageWithoutSecurityCheck(device, filename);
@@ -74,4 +61,23 @@
return Image.getImageSize(stream);
}
+/*
+ * From the class Device
+ */
+public static boolean internal(Device d) {
+ return d.internal;
}
+
+public static boolean initialized() {
+ return Device.initialized;
+}
+
+public static Color newColor(Device device, int handle) {
+ return Color.qt_new(device, handle);
+}
+
+public static Font newFont(Device device, int handle) {
+ return Font.qt_new(device, handle);
+}
+
+}
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/widgets/Internal_PackageSupport.java Fri Jul 23 12:27:20 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/widgets/Internal_PackageSupport.java Thu Aug 05 16:07:57 2010 +0300
@@ -385,6 +385,9 @@
public static void setStandardIcon(Label l, int iconType, int iconWidth, int iconHeight) {
l.setStandardIcon(iconType, iconWidth, iconHeight);
}
+public static void setThemeIcon(Label l, String iconName) {
+ l.setThemeIcon(iconName);
+}
public static void setMobileDevice(Display display, MobileDevice mobileDevice){
Display.mobileDevice = mobileDevice;
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/Canvas.java Fri Jul 23 12:27:20 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/Canvas.java Thu Aug 05 16:07:57 2010 +0300
@@ -28,7 +28,6 @@
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.internal.extension.CompositeExtension;
import org.eclipse.swt.internal.qt.graphics.WindowSurface;
import org.eclipse.swt.internal.extension.MobileShellExtension;
import org.eclipse.swt.internal.qt.SymbianWindowVisibilityListener;
@@ -191,7 +190,6 @@
//private Composite keypadComposite;
private CanvasKeypad onScreenkeypad;
private static CanvasKeypad sharedKeypad;
- private int oskHeight;
// Vector of flags that a certain key was pressed but was not released.
// Used to implement keyRepeated since eSWT does not support
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/CanvasKeypad.java Fri Jul 23 12:27:20 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/CanvasKeypad.java Thu Aug 05 16:07:57 2010 +0300
@@ -1,136 +1,129 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
package javax.microedition.lcdui;
-import java.util.Vector;
import java.util.Timer;
import java.util.TimerTask;
-import org.eclipse.ercp.swt.mobile.MobileShell;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.internal.extension.ImageUtil;
import org.eclipse.swt.internal.qt.*;
-import com.nokia.mj.impl.rt.support.ApplicationInfo;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
-import javax.microedition.lcdui.EventDispatcher.LCDUIEvent;
-
-
/**
- * The CanvasKeypad class is designed to generate the on screen keypad
- * and handle graphical operations as well as low-level pointer events.
- * CanvasKeypad maps the pointer events to key events that are needed by the Canvas.
- *
+ * The CanvasKeypad class is designed to generate the on screen keypad and
+ * handle graphical operations as well as low-level pointer events. CanvasKeypad
+ * maps the pointer events to key events that are needed by the Canvas.
+ *
*/
final class CanvasKeypad implements MouseListener, MouseMoveListener
{
-
/**
- * Constant for <code>UP</code> game action.
- */
+ * Constant for <code>UP</code> game action.
+ */
private static final int UP = -1;
/**
- * Constant for <code>DOWN</code> game action.
- */
+ * Constant for <code>DOWN</code> game action.
+ */
private static final int DOWN = -2;
/**
- * Constant for <code>LEFT</code> game action.
- */
+ * Constant for <code>LEFT</code> game action.
+ */
private static final int LEFT = -3;
/**
- * Constant for <code>RIGHT</code> game action.
- */
+ * Constant for <code>RIGHT</code> game action.
+ */
private static final int RIGHT = -4;
/**
- * Constant for <code>FIRE</code> game action.
- */
+ * Constant for <code>FIRE</code> game action.
+ */
private static final int FIRE = -5;
/**
- * Constant for <code>SLK</code> game action.
- */
+ * Constant for <code>SLK</code> game action.
+ */
private static final int SLK = -6;
/**
- * Constant for <code>SRK</code> game action.
- */
+ * Constant for <code>SRK</code> game action.
+ */
private static final int SRK = -7;
/**
- * Constant for general "<code>A</code>" game action.
- */
+ * Constant for general "<code>A</code>" game action.
+ */
private static final int GAME_A = 55;
/**
- * Constant for general "<code>B</code>" game action.
- */
+ * Constant for general "<code>B</code>" game action.
+ */
private static final int GAME_B = 57;
/**
- * Constant for general "<code>C</code>" game action.
- */
+ * Constant for general "<code>C</code>" game action.
+ */
private static final int GAME_C = 42;
/**
- * Constant for general "<code>D</code>" game action.
- */
+ * Constant for general "<code>D</code>" game action.
+ */
private static final int GAME_D = 35;
/**
- * Constant for general invalid key code.
- */
+ * Constant for general invalid key code.
+ */
private static final int INVALID_CODE = -99;
/**
- * Constant for long keypress timeout.
- */
+ * Constant for long keypress timeout.
+ */
private static final int KEYREPEAT_INTERVAL = 500;
/**
- * alpha value of a transparent pixel.
- */
+ * Alpha value of a transparent pixel.
+ */
private static final int TRANSPARENT = 0;
/**
- * keypad and game keys composites.
- */
+ * Keypad and game keys composites.
+ */
private Composite keypadComposite;
private Composite gameKeysComposite;
private Canvas canvas;
/**
- * CSS engine instance
- */
+ * CSS engine instance
+ */
private BaseCSSEngine cssEngine;
/**
- * Canvas keypad buttons.
- */
-
+ * Canvas keypad buttons.
+ */
private Label center;
private Label up;
private Label down;
@@ -169,30 +162,31 @@
private Label rockerKeyPressed;
/**
- * Timer for handling long key press and mouse move events.
- */
+ * Timer for handling long key press and mouse move events.
+ */
private Timer timer = new Timer();
private CanvasKeypadTimerTask timerTask;
/**
- * Path of the osk graphics
- */
+ * Path of the osk graphics
+ */
private static final String RESOURCE_PATH = "c:/data/images/";
/**
- * offset on the composite in pixels where the osk rocker keys are layed out.
- */
+ * Offset on the composite in pixels where the osk rocker keys are layed
+ * out.
+ */
private int image_offset;
-
/**
- * Constructs a canvas kepad based on the JAD attribute
- *
- * @param canvas - canvas for which the keypad is required.
- * @param canvasComp - Composite corresponding to the canvas.
- * @param mode- the jad attribute as a string.
- */
- CanvasKeypad(Canvas canvas, Composite canvasComp, String mode)
+ * Constructs a canvas kepad based on the JAD attribute
+ *
+ * @param canvas
+ * - canvas for which the keypad is required.
+ * @param mode
+ * - the jad attribute as a string.
+ */
+ CanvasKeypad(Canvas canvas, String mode)
{
this.canvas = canvas;
@@ -200,73 +194,68 @@
cssEngine = new BaseCSSEngine(display);
+ // Load the images
+ center_normal = ImageUtil.createImageFromTheme(display, "qtg_fr_rocker_normal_c");
+ center_pressed = ImageUtil.createImageFromTheme(display, "qtg_fr_rocker_pressed_c");
+ left_normal = ImageUtil.createImageFromTheme(display, "qtg_fr_rocker_normal_l");
+ left_pressed = ImageUtil.createImageFromTheme(display, "qtg_fr_rocker_pressed_l");
+ right_normal = ImageUtil.createImageFromTheme(display, "qtg_fr_rocker_normal_r");
+ right_pressed = ImageUtil.createImageFromTheme(display, "qtg_fr_rocker_pressed_r");
+ up_normal = ImageUtil.createImageFromTheme(display, "qtg_fr_rocker_normal_t");
+ up_pressed = ImageUtil.createImageFromTheme(display, "qtg_fr_rocker_pressed_t");
+ down_normal = ImageUtil.createImageFromTheme(display, "qtg_fr_rocker_normal_b");
+ down_pressed = ImageUtil.createImageFromTheme(display, "qtg_fr_rocker_pressed_b");
- //load the images
- center_normal = new org.eclipse.swt.graphics.Image(display,RESOURCE_PATH + "qtg_fr_rocker_normal_c.svg");
- center_pressed = new org.eclipse.swt.graphics.Image(display,RESOURCE_PATH + "qtg_fr_rocker_pressed_c.svg");
- left_normal = new org.eclipse.swt.graphics.Image(display,RESOURCE_PATH + "qtg_fr_rocker_normal_l.svg");
- left_pressed = new org.eclipse.swt.graphics.Image(display,RESOURCE_PATH + "qtg_fr_rocker_pressed_l.svg");
- right_normal = new org.eclipse.swt.graphics.Image(display,RESOURCE_PATH + "qtg_fr_rocker_normal_r.svg");
- right_pressed = new org.eclipse.swt.graphics.Image(display,RESOURCE_PATH + "qtg_fr_rocker_pressed_r.svg");
- up_normal = new org.eclipse.swt.graphics.Image(display,RESOURCE_PATH + "qtg_fr_rocker_normal_t.svg");
- up_pressed = new org.eclipse.swt.graphics.Image(display,RESOURCE_PATH + "qtg_fr_rocker_pressed_t.svg");
- down_normal = new org.eclipse.swt.graphics.Image(display,RESOURCE_PATH + "qtg_fr_rocker_normal_b.svg");
- down_pressed = new org.eclipse.swt.graphics.Image(display,RESOURCE_PATH + "qtg_fr_rocker_pressed_b.svg");
+ image_offset = (display.getBounds().width / 2) - (center_normal.getBounds().width / 2);
- image_offset = (display.getBounds().width/2) - (center_normal.getBounds().width/2);
-
- //Load image data required to determine the osk button pressed on mouse events
+ // Load image data required to determine the osk button pressed on mouse events
center_data = center_normal.getImageData();
left_data = left_normal.getImageData();
right_data = right_normal.getImageData();
up_data = up_normal.getImageData();
down_data = down_normal.getImageData();
-
- //Set form layout for the shell containing the canvas.
+ // Set form layout for the shell containing the canvas.
canvas.getShell().setLayout(new FormLayout());
- //Create the Navigation keypad
+ // Create the Navigation keypad
createNavKeypad();
- //check if game keys are needed
- if(mode.equalsIgnoreCase("gameactions"))
+ // Check if game keys are needed
+ if (mode.equalsIgnoreCase("gameactions"))
{
- //create the game key pad
createGamePad();
}
-
- //Layout the game keys, navigation keys and the canvas composites on the shell using form layout
-
+ // Layout the game keys, navigation keys and the canvas composites on
+ // the shell using form layout
FormData canvasData = new FormData();
canvasData.right = new FormAttachment(100);
canvasData.left = new FormAttachment(0);
canvasData.top = new FormAttachment(0);
canvasData.bottom = new FormAttachment(keypadComposite);
- canvasComp.setLayoutData(canvasData);
+ canvas.getContentComp().setLayoutData(canvasData);
FormData navKeyData = new FormData();
navKeyData.right = new FormAttachment(100);
navKeyData.left = new FormAttachment(0);
- if(gameKeysComposite != null)
+ if (gameKeysComposite != null)
{
- //game keypad was created above, so layout the game keys.
+ // Game keypad was created above, so layout the game keys.
navKeyData.bottom = new FormAttachment(gameKeysComposite);
}
else
{
- //game keys are not needed
+ // Game keys are not needed
navKeyData.bottom = new FormAttachment(100);
}
keypadComposite.setLayoutData(navKeyData);
-
- if(gameKeysComposite != null)
+ if (gameKeysComposite != null)
{
- //game keys were created, layout the game keys
+ // Game keys were created, layout the game keys
FormData gameKeyData = new FormData();
gameKeyData.right = new FormAttachment(100);
gameKeyData.left = new FormAttachment(0);
@@ -274,19 +263,15 @@
gameKeysComposite.setLayoutData(gameKeyData);
}
- //layout the shell
canvas.getShell().layout();
-
}
/**
- * creates the navigation keypad - the directional keys and selctio key.
- */
+ * creates the navigation keypad - the directional keys and selctio key.
+ */
private void createNavKeypad()
{
-
- //Create the navigation key composite
-
+ // Create the navigation key composite
keypadComposite = new Composite(canvas.getShell(), SWT.NONE);
center = new Label(keypadComposite, SWT.NONE);
@@ -306,39 +291,42 @@
down.setImage(down_normal);
down.pack();
- //layout the navigation keys
+ // layout the navigation keys
keypadComposite.setLayout(new FormLayout());
-
FormData navkeysFormData = new FormData();
- navkeysFormData.top=new FormAttachment(0);
- navkeysFormData.left = new FormAttachment(0,image_offset);
+ navkeysFormData.top = new FormAttachment(0);
+ navkeysFormData.left = new FormAttachment(0, image_offset);
center.setLayoutData(navkeysFormData);
left.setLayoutData(navkeysFormData);
right.setLayoutData(navkeysFormData);
up.setLayoutData(navkeysFormData);
down.setLayoutData(navkeysFormData);
- keypadComposite.pack();
+ keypadComposite.pack(); // will also layout
- keypadComposite.layout();
-
+ // The down Label will catch all mouse down events as it is covering
+ // all other rocker Labels, with the assumption that they all have
+ // the same bounds!
+ down.addMouseListener(this);
+ down.addMouseMoveListener(this);
+
+ // We want to catch all drag events occurring on top of the rocker
+ // including those starting outside.
keypadComposite.addMouseListener(this);
keypadComposite.addMouseMoveListener(this);
-
}
-
/**
- * creates the game keypad - the game action keys A, B, C and D.
- */
+ * creates the game keypad - the game action keys A, B, C and D.
+ */
private void createGamePad()
{
- //create the game pad composite
+ // create the game pad composite
gameKeysComposite = new Composite(canvas.getShell(), SWT.NONE);
gameKeysComposite.setLayout(new FormLayout());
- //Add the game buttons
+ // Add the game buttons
gameA = new Button(gameKeysComposite, SWT.PUSH);
gameA.addMouseListener(this);
@@ -351,114 +339,93 @@
gameD = new Button(gameKeysComposite, SWT.PUSH);
gameD.addMouseListener(this);
- //Set the game key style sheets
- cssEngine.applyCSS(gameA,"QPushButton" +
- "{" +
- "background-color:white;" +
- "border-style: outset;" +
- "border-width: 1px; " +
- "border-color: black;" +
- "border-radius: 2px;" +
- "font: bold 14px;" +
- "min-height: 2em;" +
- "min-width: 5.1em;" +
- "image: url(" + RESOURCE_PATH + "qtg_mono_game_a.svg);" +
- "}" +
- "QPushButton:pressed { image: url(" + RESOURCE_PATH + "qtg_mono_game_a.svg);" +
- " border-style: inset;" +
- "}");
- cssEngine.applyCSS(gameB,"QPushButton" +
- "{" +
- "background-color:white;" +
- "border-style: outset;" +
- "border-width: 1px; " +
- "border-color: black;" +
- "border-radius: 2px;" +
- "font: bold 14px;" +
- "min-height: 2em;" +
- "min-width: 5.1em;" +
- "image: url(" + RESOURCE_PATH + "qtg_mono_game_b.svg);" +
- "}" +
- "QPushButton:pressed { image: url(" + RESOURCE_PATH + "qtg_mono_game_b.svg);" +
- " border-style: inset;" +
- "}");
- cssEngine.applyCSS(gameC,"QPushButton" +
- "{" +
- "background-color:white;" +
- "border-style: outset;" +
- "border-width: 1px; " +
- "border-color: black;" +
- "border-radius: 2px;" +
- "font: bold 14px;" +
- "min-height: 2em;" +
- "min-width: 5.1em;" +
- "image: url(" + RESOURCE_PATH + "qtg_mono_game_c.svg);" +
- "}" +
- "QPushButton:pressed { image: url(" + RESOURCE_PATH + "qtg_mono_game_c.svg);" +
- " border-style: inset;" +
- "}");
- cssEngine.applyCSS(gameD,"QPushButton" +
- "{" +
- "background-color:white;" +
- "border-style: outset;" +
- "border-width: 1px; " +
- "border-color: black;" +
- "border-radius: 2px;" +
- "font: bold 14px;" +
- "min-height: 2em;" +
- "min-width: 5.1em;" +
- "image: url(" + RESOURCE_PATH + "qtg_mono_game_d.svg);" +
- "}" +
- "QPushButton:pressed { image: url(" + RESOURCE_PATH + "qtg_mono_game_d.svg);" +
- " border-style: inset;" +
- "}");
+ // Set the game key style sheets
+ cssEngine.applyCSS(gameA, "QPushButton" + "{" + "background-color:white;"
+ + "border-style: outset;" + "border-width: 1px; " + "border-color: black;"
+ + "border-radius: 2px;" + "font: bold 14px;" + "min-height: 2em;" + "min-width: 5.1em;"
+ + "image: url(" + RESOURCE_PATH + "qtg_mono_game_a.svg);" + "}"
+ + "QPushButton:pressed { image: url(" + RESOURCE_PATH + "qtg_mono_game_a.svg);"
+ + " border-style: inset;" + "}");
+ cssEngine.applyCSS(gameB, "QPushButton" + "{" + "background-color:white;"
+ + "border-style: outset;" + "border-width: 1px; " + "border-color: black;"
+ + "border-radius: 2px;" + "font: bold 14px;" + "min-height: 2em;" + "min-width: 5.1em;"
+ + "image: url(" + RESOURCE_PATH + "qtg_mono_game_b.svg);" + "}"
+ + "QPushButton:pressed { image: url(" + RESOURCE_PATH + "qtg_mono_game_b.svg);"
+ + " border-style: inset;" + "}");
+ cssEngine.applyCSS(gameC, "QPushButton" + "{" + "background-color:white;"
+ + "border-style: outset;" + "border-width: 1px; " + "border-color: black;"
+ + "border-radius: 2px;" + "font: bold 14px;" + "min-height: 2em;" + "min-width: 5.1em;"
+ + "image: url(" + RESOURCE_PATH + "qtg_mono_game_c.svg);" + "}"
+ + "QPushButton:pressed { image: url(" + RESOURCE_PATH + "qtg_mono_game_c.svg);"
+ + " border-style: inset;" + "}");
+ cssEngine.applyCSS(gameD, "QPushButton" + "{" + "background-color:white;"
+ + "border-style: outset;" + "border-width: 1px; " + "border-color: black;"
+ + "border-radius: 2px;" + "font: bold 14px;" + "min-height: 2em;" + "min-width: 5.1em;"
+ + "image: url(" + RESOURCE_PATH + "qtg_mono_game_d.svg);" + "}"
+ + "QPushButton:pressed { image: url(" + RESOURCE_PATH + "qtg_mono_game_d.svg);"
+ + " border-style: inset;" + "}");
-
- //layout the game Keys
+ // layout the game Keys
FormData gameAFormData = new FormData();
- gameAFormData.bottom=new FormAttachment(100,0);
- gameAFormData.left=new FormAttachment(0,0);
+ gameAFormData.bottom = new FormAttachment(100, 0);
+ gameAFormData.left = new FormAttachment(0, 0);
gameA.setLayoutData(gameAFormData);
FormData gameBFormData = new FormData();
- gameBFormData.bottom=new FormAttachment(100,0);
- gameBFormData.left=new FormAttachment(gameA,0);
+ gameBFormData.bottom = new FormAttachment(100, 0);
+ gameBFormData.left = new FormAttachment(gameA, 0);
gameB.setLayoutData(gameBFormData);
FormData gameCFormData = new FormData();
- gameCFormData.bottom=new FormAttachment(100,0);
- gameCFormData.left=new FormAttachment(gameB,0);
+ gameCFormData.bottom = new FormAttachment(100, 0);
+ gameCFormData.left = new FormAttachment(gameB, 0);
gameC.setLayoutData(gameCFormData);
FormData gameDFormData = new FormData();
- gameDFormData.bottom=new FormAttachment(100,0);
- gameDFormData.left=new FormAttachment(gameC,0);
+ gameDFormData.bottom = new FormAttachment(100, 0);
+ gameDFormData.left = new FormAttachment(gameC, 0);
gameD.setLayoutData(gameDFormData);
gameKeysComposite.layout();
}
/**
- * Handles orientation changes.
- */
+ * Handles orientation changes.
+ */
void handleOrientationChange(int mode)
{
- //change the layout as per orientation mode
+ // change the layout as per orientation mode
}
+ /**
+ * Sets the currect Canvas for Key events.
+ *
+ * @param canvas
+ * - Current Canvas to which the key events needs to be
+ * delivered.
+ */
+ void setCurrentCanvas(Canvas canvas)
+ {
+ this.canvas = canvas;
+ }
/**
- * Adds LSk and RSK keys to navigation keypad if the canvas is set to full screen mode.
- * @param mode- Indicates if the canvas is in fullscreen mode or not. True if fullscreen, False otherwise.
- */
+ * Adds LSk and RSK keys to navigation keypad if the canvas is set to full
+ * screen mode.
+ *
+ * @param mode
+ * - Indicates if the canvas is in fullscreen mode or not. True
+ * if fullscreen, False otherwise.
+ */
void setFullScreenMode(boolean mode)
{
- //add the soft keys if the canvas is set to full screen mode/remove otherwise
- if(mode == true)
+ // add the soft keys if the canvas is set to full screen mode/remove
+ // otherwise
+ if (mode == true)
{
- if(keypadComposite != null)
+ if (keypadComposite != null)
{
Color black = display.getSystemColor(SWT.COLOR_BLACK);
@@ -470,48 +437,31 @@
skleft = new Button(keypadComposite, SWT.PUSH);
skleft.addMouseListener(this);
- //Set the style sheet
- cssEngine.applyCSS(skright,"QPushButton" +
- "{" +
- "background-color:white;" +
- "border-style: outset;" +
- "border-width: 1px; " +
- "border-bottom-left-radius: 22px;"+
- "border-color: black;" +
- "font: bold 14px;" +
- "min-width: 3em;" +
- "min-height: 2em;" +
- "image: url(" + RESOURCE_PATH + "qtg_mono_rsk_horizontal.svg);" +
- "}" +
- "QPushButton:pressed { image: url(" + RESOURCE_PATH + "qtg_mono_rsk_horizontal.svg);" +
- " border-style: inset;" +
- "}");
+ // Set the style sheet
+ cssEngine.applyCSS(skright, "QPushButton" + "{" + "background-color:white;"
+ + "border-style: outset;" + "border-width: 1px; "
+ + "border-bottom-left-radius: 22px;" + "border-color: black;"
+ + "font: bold 14px;" + "min-width: 3em;" + "min-height: 2em;" + "image: url("
+ + RESOURCE_PATH + "qtg_mono_rsk_horizontal.svg);" + "}"
+ + "QPushButton:pressed { image: url(" + RESOURCE_PATH
+ + "qtg_mono_rsk_horizontal.svg);" + " border-style: inset;" + "}");
- cssEngine.applyCSS(skleft,"QPushButton" +
- "{" +
- "background-color:white;" +
- "border-style: outset;" +
- "border-width: 1px; " +
- "border-bottom-right-radius: 22px;"+
- "border-color: black;" +
- "font: bold 14px;" +
- "min-width: 3em;" +
- "min-height: 2em;" +
- "image: url(" + RESOURCE_PATH + "qtg_mono_lsk_horizontal.svg);" +
- "}" +
- "QPushButton:pressed { image: url(" + RESOURCE_PATH + "qtg_mono_lsk_horizontal.svg);" +
- " border-style: inset;" +
- "}");
-
+ cssEngine.applyCSS(skleft, "QPushButton" + "{" + "background-color:white;"
+ + "border-style: outset;" + "border-width: 1px; "
+ + "border-bottom-right-radius: 22px;" + "border-color: black;"
+ + "font: bold 14px;" + "min-width: 3em;" + "min-height: 2em;" + "image: url("
+ + RESOURCE_PATH + "qtg_mono_lsk_horizontal.svg);" + "}"
+ + "QPushButton:pressed { image: url(" + RESOURCE_PATH
+ + "qtg_mono_lsk_horizontal.svg);" + " border-style: inset;" + "}");
FormData sklFormData = new FormData();
- sklFormData.top=new FormAttachment(0, 0);
- sklFormData.left=new FormAttachment(0, 0);
+ sklFormData.top = new FormAttachment(0, 0);
+ sklFormData.left = new FormAttachment(0, 0);
skleft.setLayoutData(sklFormData);
FormData skrFormData = new FormData();
- skrFormData.top=new FormAttachment(0, 0);
- skrFormData.right=new FormAttachment(100, 0);
+ skrFormData.top = new FormAttachment(0, 0);
+ skrFormData.right = new FormAttachment(100, 0);
skright.setLayoutData(skrFormData);
keypadComposite.layout();
@@ -519,10 +469,11 @@
}
else
{
- //LSK and RSK buttons are not needed, remove the buttons from navigation keypad
- if(skright != null)
+ // LSK and RSK buttons are not needed, remove the buttons from
+ // navigation keypad
+ if (skright != null)
skright.dispose();
- if(skleft != null)
+ if (skleft != null)
skleft.dispose();
keypadComposite.setBackground(null);
@@ -531,384 +482,332 @@
}
/**
- * returns the height of the canvas keypad in pixels.
- * @return Height of the canvas keypad in pixels.
- */
+ * returns the height of the canvas keypad in pixels.
+ *
+ * @return Height of the canvas keypad in pixels.
+ */
int getHeight()
{
int navKeyPadHeight = 0;
int gameKeyPadHeight = 0;
- if(keypadComposite != null)
+ if (keypadComposite != null)
{
- //calculate the navigation keypad height
+ // calculate the navigation keypad height
navKeyPadHeight = keypadComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
}
- if(gameKeysComposite != null)
+ if (gameKeysComposite != null)
{
- //calculate the game keypad height
+ // calculate the game keypad height
gameKeyPadHeight = gameKeysComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
}
- //return the total height
+ // return the total height
return (navKeyPadHeight + gameKeyPadHeight);
}
/**
- * returns the keycode corresponding to the canvas keypad button.
- * @return keycode.
- */
+ * returns the keycode corresponding to the canvas keypad button.
+ *
+ * @return keycode.
+ */
private int getKeyCode(Widget w)
{
-
int keyCode = INVALID_CODE;
// Find out which osk button was pressed
- if(w == up)
+ if (w == up)
{
keyCode = UP;
}
- else if(w == down)
+ else if (w == down)
{
keyCode = DOWN;
}
- else if(w == left)
+ else if (w == left)
{
keyCode = LEFT;
}
- else if(w == right)
+ else if (w == right)
{
keyCode = RIGHT;
}
- else if(w == center)
+ else if (w == center)
{
keyCode = FIRE;
}
- else if(w == skleft)
+ else if (w == skleft)
{
keyCode = SLK;
}
- else if(w == skright)
+ else if (w == skright)
{
keyCode = SRK;
}
- else if(w == gameA)
+ else if (w == gameA)
{
keyCode = GAME_A;
}
- else if(w == gameB)
+ else if (w == gameB)
{
keyCode = GAME_B;
}
- else if(w == gameC)
+ else if (w == gameC)
{
keyCode = GAME_C;
}
- else if(w == gameD)
+ else if (w == gameD)
{
keyCode = GAME_D;
}
else
{
- keyCode = INVALID_CODE;;
+ keyCode = INVALID_CODE;
}
return keyCode;
}
-
/**
- * Mouse listeners.
- */
-
+ * Mouse listeners.
+ */
public void mouseDown(MouseEvent e)
{
-
- //handle the mouse down event
handleMouseDown(e);
-
}
public void mouseUp(MouseEvent e)
{
-
- //handle the mouse up event
handleMouseUp(e);
-
}
public void mouseMove(MouseEvent e)
{
-
- //handle the mouse move event
handleMouseMove(e);
-
}
public void mouseDoubleClick(MouseEvent event)
{
- //do nothing
+ // Do nothing
}
-
-
-
-
/**
- * Handles the mouse down event
- *
- */
+ * Handles the mouse down event
+ * Note that e.x and e.y are relative to the widget that was pressed.
+ */
private void handleMouseDown(MouseEvent e)
{
-
- if(e.widget == keypadComposite)
+ if (e.widget == down) // highest in the z-order
{
- //the mouse down was grabbed by the keypad composite, map the key code based on the on rocker images.
keyPressed = handleRockerPressed(e);
-
}
else
{
- //get the keycode of the game or soft keys based on the button that was clicked
keyPressed = getKeyCode(e.widget);
}
- if(keyPressed != INVALID_CODE)
+ if (keyPressed != INVALID_CODE)
{
-
- //notify the canvas
canvas.doKeyPressed(keyPressed);
- // Create and Schedule the long keypress timer
timerTask = new CanvasKeypadTimerTask();
timer.schedule(timerTask, KEYREPEAT_INTERVAL);
}
}
/**
- * Handles the mouse up event
- *
- */
+ * Handles the mouse up event
+ * Note that e.x and e.y are relative to the widget that was pressed.
+ */
private void handleMouseUp(MouseEvent e)
{
int keyReleased;
- if(timerTask != null)
- {
- //cancel the long keypress timer if it is running
- timerTask.cancel();
- timerTask = null;
- }
-
- if(e.widget == keypadComposite)
- {
- //the mouse up was grabbed by the keypad composite, map the key code based on the on rocker images.
- keyReleased = handleRockerReleased(e);
-
- }
- else
+ if (timerTask != null)
{
- //get the keycode of the game or soft keys based on the button that was clicked
- keyReleased = getKeyCode(e.widget);
- }
-
- if(keyReleased != INVALID_CODE)
- {
-
- //notify the canvas
- canvas.doKeyReleased(keyReleased);
- }
- }
-
-
- /**
- * Handles the mouse move event
- *
- */
- private void handleMouseMove(MouseEvent e)
- {
-
- if(timerTask != null)
- {
- //cancel the long keypress timer if it is running
timerTask.cancel();
timerTask = null;
}
- if(e.widget == keypadComposite)
+ if (e.widget == down || e.widget == keypadComposite)
{
- //the mouse move was grabbed by the keypad composite, handle the rocker key swipe
- handleRockerMoved(e);
-
+ keyReleased = handleRockerReleased(e);
}
else
{
- //get the keycode of the game or soft keys based on the button that was clicked
- keyPressed = getKeyCode(e.widget);
+ keyReleased = getKeyCode(e.widget);
+ }
+
+ if (keyReleased != INVALID_CODE)
+ {
+ canvas.doKeyReleased(keyReleased);
+ }
+ }
- //notify the canvas
+ /**
+ * Handles the mouse move event
+ * Note that e.x and e.y are relative to the widget that was pressed.
+ */
+ private void handleMouseMove(MouseEvent e)
+ {
+ if (timerTask != null)
+ {
+ timerTask.cancel();
+ timerTask = null;
+ }
+
+ if (e.widget == down || e.widget == keypadComposite)
+ {
+ handleRockerMoved(e);
+ }
+ else
+ {
+ keyPressed = getKeyCode(e.widget);
canvas.doKeyPressed(keyPressed);
-
- // Create and Schedule Timer
timerTask = new CanvasKeypadTimerTask();
timer.schedule(timerTask, KEYREPEAT_INTERVAL);
}
-
-
}
-
/**
- * Handles the rocker key press
- *
- */
+ * Handles the rocker key press
+ */
private int handleRockerPressed(MouseEvent e)
{
-
keyPressed = INVALID_CODE;
-
- Rectangle image_bounds = center.getBounds();
-
- // Find out which rocker button was pressed
- if(image_bounds.contains(e.x,e.y) == true)
+
+ Point rockerSize = center.getSize();
+ if (e.x >= 0 && e.x <= rockerSize.x && e.y >= 0 && e.y <= rockerSize.y)
{
- //check each of the button images to check which osk navkey button was pressed
- if(center_data.getAlpha(e.x-image_offset,e.y)!=TRANSPARENT)
+ if (center_data.getAlpha(e.x, e.y) != TRANSPARENT)
{
- //center button was pressed
keyPressed = FIRE;
rockerKeyPressed = center;
center.setImage(center_pressed);
}
- else if(left_data.getAlpha(e.x-image_offset,e.y)!=TRANSPARENT)
+ else if (left_data.getAlpha(e.x, e.y) != TRANSPARENT)
{
- //left button was pressed
keyPressed = LEFT;
rockerKeyPressed = left;
left.setImage(left_pressed);
}
- else if(right_data.getAlpha(e.x-image_offset,e.y)!=TRANSPARENT)
+ else if (right_data.getAlpha(e.x, e.y) != TRANSPARENT)
{
- //right button was pressed
keyPressed = RIGHT;
rockerKeyPressed = right;
right.setImage(right_pressed);
}
- else if(up_data.getAlpha(e.x-image_offset,e.y)!=TRANSPARENT)
+ else if (up_data.getAlpha(e.x, e.y) != TRANSPARENT)
{
- //up button was pressed
keyPressed = UP;
rockerKeyPressed = up;
up.setImage(up_pressed);
}
- else if(down_data.getAlpha(e.x-image_offset,e.y)!=TRANSPARENT)
+ else if (down_data.getAlpha(e.x, e.y) != TRANSPARENT)
{
- //down button was pressed
keyPressed = DOWN;
rockerKeyPressed = down;
down.setImage(down_pressed);
}
else
{
- keyPressed = INVALID_CODE;;
+ keyPressed = INVALID_CODE;
}
-
}
return keyPressed;
-
}
-
/**
- * Handles the mouse released on the rocker keys
- *
- */
+ * Handles the mouse released on the rocker keys
+ */
private int handleRockerReleased(MouseEvent e)
{
-
int keyReleased = INVALID_CODE;
- Rectangle image_bounds = center.getBounds();
-
- // Find out which rocker button was released
- if(image_bounds.contains(e.x,e.y) == true)
+ Point rockerSize = center.getSize();
+ Point rockerLoc = center.getLocation();
+
+ if (e.widget == keypadComposite)
{
- //check each of the button images to check which osk navkey button was released
- if((rockerKeyPressed == center) &&
- (center_data.getAlpha(e.x-image_offset,e.y)!=TRANSPARENT))
+ // Drag started outside rocker
+ e.x -= rockerLoc.x;
+ e.y -= rockerLoc.y;
+ }
+
+ if (e.x >= 0 && e.x <= rockerSize.x && e.y >= 0 && e.y <= rockerSize.y)
+ {
+ if ((rockerKeyPressed == center)
+ && (center_data.getAlpha(e.x, e.y) != TRANSPARENT))
{
- //center button was released
keyReleased = FIRE;
center.setImage(center_normal);
}
- else if((rockerKeyPressed == left) &&
- (left_data.getAlpha(e.x-image_offset,e.y)!=TRANSPARENT))
+ else if ((rockerKeyPressed == left)
+ && (left_data.getAlpha(e.x, e.y) != TRANSPARENT))
{
- //left button was released
keyReleased = LEFT;
left.setImage(left_normal);
}
- else if((rockerKeyPressed == right) &&
- (right_data.getAlpha(e.x-image_offset,e.y)!=TRANSPARENT))
+ else if ((rockerKeyPressed == right)
+ && (right_data.getAlpha(e.x, e.y) != TRANSPARENT))
{
- //right button was released
keyReleased = RIGHT;
right.setImage(right_normal);
}
- else if((rockerKeyPressed == up) &&
- (up_data.getAlpha(e.x-image_offset,e.y)!=TRANSPARENT))
+ else if ((rockerKeyPressed == up)
+ && (up_data.getAlpha(e.x, e.y) != TRANSPARENT))
{
- //up button was released
keyReleased = UP;
up.setImage(up_normal);
}
- else if((rockerKeyPressed == down) &&
- (down_data.getAlpha(e.x-image_offset,e.y)!=TRANSPARENT))
+ else if ((rockerKeyPressed == down)
+ && (down_data.getAlpha(e.x, e.y) != TRANSPARENT))
{
- //down button was released
keyReleased = DOWN;
down.setImage(down_normal);
}
else
{
- keyReleased = INVALID_CODE;;
+ keyReleased = INVALID_CODE;
}
-
}
return keyReleased;
-
}
-
/**
- * Handles the mouse move on the rocker keys
- *
- */
+ * Handles the mouse move on the rocker keys
+ */
private void handleRockerMoved(MouseEvent e)
{
-
keyPressed = INVALID_CODE;
-
- Rectangle image_bounds = center.getBounds();
+ Point size = center.getSize();
+ Point rockerLoc = center.getLocation();
+
+ if (e.widget == keypadComposite)
+ {
+ // Drag started outside rocker
+ e.x -= rockerLoc.x;
+ e.y -= rockerLoc.y;
+ }
- // Find out which rocker button was traversed to
- if(image_bounds.contains(e.x,e.y) == true)
+ if (e.x >= 0 && e.x <= size.x && e.y >= 0 && e.y <= size.y)
{
- //check each of the button images to check which osk navkey button was traversed to
- if((center_data.getAlpha(e.x-image_offset,e.y)!=TRANSPARENT) &&
- (rockerKeyPressed != center))
+ if ((center_data.getAlpha(e.x, e.y) != TRANSPARENT)
+ && (rockerKeyPressed != center))
{
- //Mouse moved to center rocker key from another rocker key, release the other(source) rocker key
+ // Mouse moved to center rocker key from another rocker key,
+ // release the other(source) rocker key
releaseRockerKey(rockerKeyPressed);
}
- else if((left_data.getAlpha(e.x-image_offset,e.y)!=TRANSPARENT) &&
- (rockerKeyPressed != left))
+ else if ((left_data.getAlpha(e.x, e.y) != TRANSPARENT)
+ && (rockerKeyPressed != left))
{
- //Mouse moved to left rocker key from another rocker key, release the other(source) rocker key
+ // Mouse moved to left rocker key from another rocker key,
+ // release the other(source) rocker key
// and press the left key
releaseRockerKey(rockerKeyPressed);
keyPressed = LEFT;
@@ -917,10 +816,11 @@
canvas.doKeyPressed(keyPressed);
pressedKeyData = left_data;
}
- else if((right_data.getAlpha(e.x-image_offset,e.y)!=TRANSPARENT) &&
- (rockerKeyPressed != right))
+ else if ((right_data.getAlpha(e.x, e.y) != TRANSPARENT)
+ && (rockerKeyPressed != right))
{
- //Mouse moved to right rocker key from another rocker key, release the other(source) rocker key
+ // Mouse moved to right rocker key from another rocker key,
+ // release the other(source) rocker key
// and press the right key
releaseRockerKey(rockerKeyPressed);
keyPressed = RIGHT;
@@ -929,10 +829,11 @@
canvas.doKeyPressed(keyPressed);
pressedKeyData = right_data;
}
- else if((up_data.getAlpha(e.x-image_offset,e.y)!=TRANSPARENT) &&
- (rockerKeyPressed != up))
+ else if ((up_data.getAlpha(e.x, e.y) != TRANSPARENT)
+ && (rockerKeyPressed != up))
{
- //Mouse moved to up rocker key from another rocker key, release the other(source) rocker key
+ // Mouse moved to up rocker key from another rocker key, release
+ // the other(source) rocker key
// and press the up key
releaseRockerKey(rockerKeyPressed);
keyPressed = UP;
@@ -941,10 +842,11 @@
rockerKeyPressed = up;
pressedKeyData = up_data;
}
- else if((down_data.getAlpha(e.x-image_offset,e.y)!=TRANSPARENT) &&
- (rockerKeyPressed != down))
+ else if ((down_data.getAlpha(e.x, e.y) != TRANSPARENT)
+ && (rockerKeyPressed != down))
{
- //Mouse moved to down rocker key from another rocker key, release the other(source) rocker key
+ // Mouse moved to down rocker key from another rocker key,
+ // release the other(source) rocker key
// and press the down key
releaseRockerKey(rockerKeyPressed);
keyPressed = DOWN;
@@ -955,76 +857,65 @@
}
else
{
- if((pressedKeyData != null) &&
- (pressedKeyData.getAlpha(e.x-image_offset,e.y) == TRANSPARENT))
+ if ((pressedKeyData != null)
+ && (pressedKeyData.getAlpha(e.x, e.y) == TRANSPARENT))
{
- //Mouse moved to out of all rocker keys from another rocker key, release the other(source) rocker key
+ // Mouse moved to out of all rocker keys from another rocker
+ // key, release the other(source) rocker key
releaseRockerKey(rockerKeyPressed);
pressedKeyData = null;
rockerKeyPressed = null;
}
}
-
}
else
{
- //Mouse moved to out of all rocker keys, release the other(source) rocker key
+ // Mouse moved to out of all rocker keys, release the other(source)
+ // rocker key
releaseRockerKey(rockerKeyPressed);
}
-
-
}
-
-
/**
- * Releases a rocker key
- *
- */
+ * Releases a rocker key
+ */
private void releaseRockerKey(Label rockerKeyPressed)
{
-
- if(rockerKeyPressed == center)
+ if (rockerKeyPressed == center)
{
center.setImage(center_normal);
canvas.doKeyReleased(FIRE);
}
- else if(rockerKeyPressed == left)
+ else if (rockerKeyPressed == left)
{
left.setImage(left_normal);
canvas.doKeyReleased(LEFT);
}
- else if(rockerKeyPressed == right)
+ else if (rockerKeyPressed == right)
{
right.setImage(right_normal);
canvas.doKeyReleased(RIGHT);
}
- else if(rockerKeyPressed == up)
+ else if (rockerKeyPressed == up)
{
up.setImage(up_normal);
canvas.doKeyReleased(UP);
}
- else if(rockerKeyPressed == down)
+ else if (rockerKeyPressed == down)
{
down.setImage(down_normal);
canvas.doKeyReleased(DOWN);
}
-
}
-
-
/**
- * Canvas Keypad timer task
- *
- */
+ * Canvas Keypad timer task
+ */
class CanvasKeypadTimerTask extends TimerTask
{
-
public void run()
{
-
ESWTUIThreadRunner.syncExec(new Runnable()
{
public void run()
@@ -1032,11 +923,6 @@
canvas.doKeyPressed(keyPressed);
}
});
-
-
}
}
-
-
-
}
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/ChoiceGroup.java Fri Jul 23 12:27:20 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/ChoiceGroup.java Thu Aug 05 16:07:57 2010 +0300
@@ -23,6 +23,18 @@
*/
public class ChoiceGroup extends Item implements Choice
{
+ /**
+ * If ChoiceGroup is changed, reasons for Re-layouting.
+ */
+ static final int UPDATE_REASON_APPEND = UPDATE_ITEM_MAX << 1;
+ static final int UPDATE_REASON_DELETE = UPDATE_ITEM_MAX << 2;
+ static final int UPDATE_REASON_DELETEALL = UPDATE_ITEM_MAX << 3;
+ static final int UPDATE_REASON_INSERT = UPDATE_ITEM_MAX << 4;
+ static final int UPDATE_REASON_SET = UPDATE_ITEM_MAX << 5;
+ static final int UPDATE_FITPOLICY = UPDATE_ITEM_MAX << 6;
+ static final int UPDATE_FONT = UPDATE_ITEM_MAX << 7;
+ static final int UPDATE_SELECTEDFLAGS = UPDATE_ITEM_MAX << 8;
+ static final int UPDATE_SELECTEDINDEX = UPDATE_ITEM_MAX << 9;
private ChoiceImpl choiceImpl;
private int type;
@@ -90,7 +102,7 @@
public int append(String text, Image img)
{
int ret = choiceImpl.append(text, img);
- updateParent(UPDATE_SIZE_CHANGED);
+ updateParent(UPDATE_REASON_APPEND);
return ret;
}
@@ -104,7 +116,7 @@
public void insert(int position, String text, Image img)
{
choiceImpl.insert(position, text, img);
- updateParent(UPDATE_SIZE_CHANGED);
+ updateParent(UPDATE_REASON_INSERT);
}
/**
@@ -117,7 +129,7 @@
public void set(int position, String text, Image img)
{
choiceImpl.set(position, text, img);
- updateParent(UPDATE_CONTENT);
+ updateParent(UPDATE_REASON_SET);
}
/**
@@ -128,7 +140,7 @@
public void delete(int position)
{
choiceImpl.delete(position);
- updateParent(UPDATE_SIZE_CHANGED);
+ updateParent(UPDATE_REASON_DELETE);
}
/**
@@ -137,7 +149,7 @@
public void deleteAll()
{
choiceImpl.deleteAll();
- updateParent(UPDATE_SIZE_CHANGED);
+ updateParent(UPDATE_REASON_DELETEALL);
}
/**
@@ -223,7 +235,7 @@
public void setFitPolicy(int newFitPolicy)
{
choiceImpl.setFitPolicy(newFitPolicy);
- updateParent(UPDATE_SIZE_CHANGED);
+ updateParent(UPDATE_FITPOLICY);
}
/**
@@ -235,7 +247,7 @@
public void setFont(int position, Font font)
{
choiceImpl.setFont(position, font);
- updateParent(UPDATE_SIZE_CHANGED);
+ updateParent(UPDATE_FONT);
}
/**
@@ -246,7 +258,7 @@
public void setSelectedFlags(boolean[] selectedArray)
{
choiceImpl.setSelectedFlags(selectedArray);
- updateParent(UPDATE_CONTENT);
+ updateParent(UPDATE_SELECTEDFLAGS);
}
/**
@@ -258,7 +270,7 @@
public void setSelectedIndex(int position, boolean select)
{
choiceImpl.setSelected(position, select);
- updateParent(UPDATE_CONTENT);
+ updateParent(UPDATE_SELECTEDINDEX);
}
/**
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/ChoiceGroupLayouter.java Fri Jul 23 12:27:20 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/ChoiceGroupLayouter.java Thu Aug 05 16:07:57 2010 +0300
@@ -45,9 +45,9 @@
/**
* Constructor.
*/
- ChoiceGroupLayouter(DefaultFormLayoutPolicy dflp)
+ ChoiceGroupLayouter(FormLayouter aFormLayouter)
{
- super(dflp);
+ super(aFormLayouter);
}
/**
@@ -259,7 +259,7 @@
*/
boolean eswtOfferKeyPressed(Item item, int key)
{
- LayoutObject lo = dfi.getFirstLayoutObjectOfItem(item);
+ LayoutObject lo = formLayouter.getFirstLayoutObjectOfItem(item);
TableExtension tempExt;
ChoiceGroup chgr = (ChoiceGroup) item;
tempExt = (TableExtension) eswtFindSpecificControl(item,
@@ -478,7 +478,7 @@
private void update(SelectionEvent se)
{
- //int vPosition = dfi.vPosition;
+ //int vPosition = formLayouter.vPosition;
int index = ((Table) se.widget).indexOf((TableItem) se.item);
choiceGroup.internalSetSelectedIndex(index,
!choiceGroup.isSelected(index));
@@ -546,20 +546,20 @@
int topOfTable = table.getLocation().y;
if(choicegroup.hasLabel())
{
- LayoutObject lo = dfi.getFirstLayoutObjectOfItem(choicegroup);
+ LayoutObject lo = formLayouter.getFirstLayoutObjectOfItem(choicegroup);
topOfTable += lo.getY();
}
int topYOfSelectedItem = topOfTable + (focusedIndex * itemHeight);
if(te.keyCode == SWT.ARROW_DOWN)
{
topYOfSelectedItem += itemHeight;
- dfi.eswtScrollIfNeeded(topYOfSelectedItem,
+ formLayouter.eswtScrollIfNeeded(topYOfSelectedItem,
topYOfSelectedItem + itemHeight);
}
else if(te.keyCode == SWT.ARROW_UP)
{
topYOfSelectedItem -= itemHeight;
- dfi.eswtScrollIfNeeded(topYOfSelectedItem,
+ formLayouter.eswtScrollIfNeeded(topYOfSelectedItem,
topYOfSelectedItem + itemHeight);
}
}
@@ -582,7 +582,7 @@
public void focusGained(FocusEvent focusEvent)
{
TableExtension te = (TableExtension) focusEvent.widget;
- int direction = dfi.getDirection();
+ int direction = formLayouter.getDirection();
if(choicegroup.getType() != ChoiceGroup.POPUP)
{
if(direction == -1)
@@ -608,7 +608,7 @@
int topOfTable = te.getLocation().y;
if(choicegroup.hasLabel())
{
- LayoutObject lo = dfi.getFirstLayoutObjectOfItem(choicegroup);
+ LayoutObject lo = formLayouter.getFirstLayoutObjectOfItem(choicegroup);
topOfTable += lo.getY();
}
@@ -616,13 +616,13 @@
if(direction == SWT.ARROW_DOWN || direction == SWT.ARROW_RIGHT)
{
topYOfSelectedItem += itemHeight;
- dfi.eswtScrollIfNeeded(topYOfSelectedItem,
+ formLayouter.eswtScrollIfNeeded(topYOfSelectedItem,
topYOfSelectedItem + itemHeight);
}
else if(direction == SWT.ARROW_UP || direction == SWT.ARROW_LEFT)
{
topYOfSelectedItem -= itemHeight;
- dfi.eswtScrollIfNeeded(topYOfSelectedItem,
+ formLayouter.eswtScrollIfNeeded(topYOfSelectedItem,
topYOfSelectedItem + itemHeight);
}
}
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/Command.java Fri Jul 23 12:27:20 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/Command.java Thu Aug 05 16:07:57 2010 +0300
@@ -132,11 +132,7 @@
this.shortLabel = shortLabel;
this.longLabel = longLabel;
this.priority = priority;
-
- if(EMPTY_STRING.equals(this.shortLabel))
- {
- this.shortLabel = getDefaultLabel(this.type);
- }
+
}
/**
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/CustomItem.java Fri Jul 23 12:27:20 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/CustomItem.java Thu Aug 05 16:07:57 2010 +0300
@@ -20,16 +20,13 @@
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.internal.extension.CanvasExtension;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Scrollable;
/**
* Implementation of LCDUI abstract <code>CustomItem</code> class.
*/
public abstract class CustomItem extends Item
{
-
protected static final int NONE = 0;
protected static final int TRAVERSE_HORIZONTAL = 1;
protected static final int TRAVERSE_VERTICAL = 2;
@@ -43,9 +40,10 @@
protected static final int POINTER_DRAG = 0x80;
/**
- * Constant used by layouter to repaint CustomItem's rectangle section.
+ * If CustomItem is changed, reasons for Re-layouting.
*/
- static final int UPDATE_REPAINT_RECT = 4;
+ static final int UPDATE_REASON_REPAINT = UPDATE_ITEM_MAX << 1;
+
private boolean cleanupNeeded;
private int contentWidth;
@@ -68,7 +66,7 @@
// Graphics command buffer for this instance
Buffer graphicsBuffer;
- Graphics CustomItemGraphics;
+ Graphics customItemGraphics;
CustomItemLayouter layouter;
@@ -154,7 +152,7 @@
{
Rectangle rect = new Rectangle(aX, aY, aWidth, aHeight);
// From here it goes to updateItem()
- updateParent(UPDATE_REPAINT_RECT, rect);
+ updateParent(UPDATE_REASON_REPAINT, rect);
}
/**
@@ -308,7 +306,7 @@
contentHeight = newHeight;
}
EventDispatcher eventDispatcher = EventDispatcher.instance();
- LCDUIEvent event = eventDispatcher.newEvent(LCDUIEvent.CUSTOMITEM_SIZECHANGED, layouter.dfi.getForm());
+ LCDUIEvent event = eventDispatcher.newEvent(LCDUIEvent.CUSTOMITEM_SIZECHANGED, layouter.formLayouter.getForm());
event.item = this;
eventDispatcher.postEvent(event);
synchronized(cleanupLock)
@@ -356,7 +354,7 @@
else
{
// Item was added to a Form
- layouter = ((CustomItemLayouter)((Form)parent).getLayoutPolicy().getLayouter(this));
+ layouter = ((CustomItemLayouter)((Form)parent).getFormLayouter().getItemLayouter(this));
}
}
@@ -432,7 +430,7 @@
{
EventDispatcher eventDispatcher = EventDispatcher.instance();
LCDUIEvent event = eventDispatcher.newEvent(
- LCDUIEvent.CUSTOMITEM_PAINT_MIDLET_REQUEST, layouter.dfi.getForm());
+ LCDUIEvent.CUSTOMITEM_PAINT_MIDLET_REQUEST, layouter.formLayouter.getForm());
event.widget = control;
event.item = this;
eventDispatcher.postEvent(event);
@@ -550,11 +548,11 @@
widgetDisposed = true;
return;
}
- if(CustomItemGraphics == null)
+ if(customItemGraphics == null)
{
graphicsBuffer = Buffer.createInstance(self, (Control)event.widget);
- CustomItemGraphics = graphicsBuffer.getGraphics();
- CustomItemGraphics.setSyncStrategy(Graphics.SYNC_LEAVE_SURFACE_SESSION_OPEN);
+ customItemGraphics = graphicsBuffer.getGraphics();
+ customItemGraphics.setSyncStrategy(Graphics.SYNC_LEAVE_SURFACE_SESSION_OPEN);
}
else
{
@@ -583,17 +581,18 @@
contentHeight = this.contentHeight;
}
- CustomItemGraphics.setClip(0, 0, contentWidth, contentHeight);
- CustomItemGraphics.cleanBackground(new Rectangle(0, 0, contentWidth, contentHeight));
+ customItemGraphics.setClip(0, 0, contentWidth, contentHeight);
+ customItemGraphics.cleanBackground(new Rectangle(0, 0, contentWidth, contentHeight));
cleanupNeeded = false;
}
}
// Clip must define the invalid area
- CustomItemGraphics.setClip(redrawNowX, redrawNowY, redrawNowW, redrawNowH);
+ customItemGraphics.reset();
+ customItemGraphics.setClip(redrawNowX, redrawNowY, redrawNowW, redrawNowH);
// The callback
- paint(CustomItemGraphics, contentWidth, contentHeight);
+ paint(customItemGraphics, contentWidth, contentHeight);
// Wait until the UI thread is available. Then in the UI thread
// synchronously send a paint event.
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/CustomItemBufferLinux.java Fri Jul 23 12:27:20 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/CustomItemBufferLinux.java Thu Aug 05 16:07:57 2010 +0300
@@ -43,7 +43,7 @@
protected void init()
{
super.init();
- surface = Internal_PackageSupport.getWindowsurface(host.layouter.dfi.getForm().getContentComp().getShell());
+ surface = Internal_PackageSupport.getWindowsurface(host.layouter.formLayouter.getForm().getContentComp().getShell());
}
void bindToHost(GraphicsContext gc) {
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/CustomItemBufferSymbian.java Fri Jul 23 12:27:20 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/CustomItemBufferSymbian.java Thu Aug 05 16:07:57 2010 +0300
@@ -39,7 +39,7 @@
protected void init()
{
super.init();
- surface = Internal_PackageSupport.getWindowsurface(host.layouter.dfi.getForm().getContentComp().getShell());
+ surface = Internal_PackageSupport.getWindowsurface(host.layouter.formLayouter.getForm().getContentComp().getShell());
}
int getHostType()
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/CustomItemLayouter.java Fri Jul 23 12:27:20 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/CustomItemLayouter.java Thu Aug 05 16:07:57 2010 +0300
@@ -64,11 +64,11 @@
/**
* Constructor.
*
- * @param dflp DefaultFormLayoutPolicy used for layouting.
+ * @param aFormLayouter FormLayouter used for layouting.
*/
- public CustomItemLayouter(DefaultFormLayoutPolicy dflp)
+ public CustomItemLayouter(FormLayouter aFormLayouter)
{
- super(dflp);
+ super(aFormLayouter);
noBackground = JadAttributeUtil.isValue(JadAttributeUtil.ATTRIB_NOKIA_UI_ENHANCEMENT,
JadAttributeUtil.VALUE_CANVAS_HAS_BACKGROUND);
@@ -205,7 +205,7 @@
*/
void eswtUpdateItem(Item item, Control control, int reason, Object param)
{
- if(reason == CustomItem.UPDATE_REPAINT_RECT)
+ if(reason == CustomItem.UPDATE_REASON_REPAINT)
{
Rectangle rect = (Rectangle) param;
((CustomItem)item).updateItem(rect, control);
@@ -267,7 +267,7 @@
if(!((selectionKeyCompatibility == true) && (key == -5)))
{
EventDispatcher eventDispatcher = EventDispatcher.instance();
- LCDUIEvent e = eventDispatcher.newEvent(LCDUIEvent.CUSTOMITEM_KEYPRESSED, dfi.getForm());
+ LCDUIEvent e = eventDispatcher.newEvent(LCDUIEvent.CUSTOMITEM_KEYPRESSED, formLayouter.getForm());
e.item = customItem;
e.keyCode = key;
eventDispatcher.postEvent(e);
@@ -282,13 +282,13 @@
int[] visRect = getVisRect(ctrl);
// Offer event for inner traversal
consumed = customItem.traverse(direction,
- dfi.getFormWidth(), dfi.getFormHeight(), visRect);
+ formLayouter.getFormWidth(), formLayouter.getFormHeight(), visRect);
if(consumed)
{
// if inner focus is on - scroll to inner focus
Point loc = new Point(0, 0);
- dfi.getControlPositionOnComposite(ctrl, loc);
- dfi.eswtScrolltoRegion(loc.y + visRect[1],
+ formLayouter.getControlPositionOnComposite(ctrl, loc);
+ formLayouter.eswtScrolltoRegion(loc.y + visRect[1],
loc.y + visRect[1] + visRect[3], key);
}
control.redraw();
@@ -306,7 +306,7 @@
if(!((selectionKeyCompatibility == true) && (key == -5)))
{
EventDispatcher eventDispatcher = EventDispatcher.instance();
- LCDUIEvent e = eventDispatcher.newEvent(LCDUIEvent.CUSTOMITEM_KEYRELEASED, dfi.getForm());
+ LCDUIEvent e = eventDispatcher.newEvent(LCDUIEvent.CUSTOMITEM_KEYRELEASED, formLayouter.getForm());
e.item = customItem;
e.keyCode = key;
eventDispatcher.postEvent(e);
@@ -332,12 +332,12 @@
Control ctrl = eswtFindSpecificControl(item, control);
int[] visRect = getVisRect(ctrl);
if(customItem.traverse(getCanvasDirection(swtDir),
- dfi.getFormWidth(), dfi.getFormHeight(), visRect))
+ formLayouter.getFormWidth(), formLayouter.getFormHeight(), visRect))
{
// if inner focus is on - scroll to inner focus
Point loc = new Point(0, 0);
- dfi.getControlPositionOnComposite(ctrl, loc);
- dfi.eswtScrolltoRegion(loc.y + visRect[1],
+ formLayouter.getControlPositionOnComposite(ctrl, loc);
+ formLayouter.eswtScrolltoRegion(loc.y + visRect[1],
loc.y + visRect[1] + visRect[3], swtDir);
}
control.redraw();
@@ -360,7 +360,7 @@
void eswtHandleShow(Item item)
{
EventDispatcher eventDispatcher = EventDispatcher.instance();
- LCDUIEvent event = eventDispatcher.newEvent(LCDUIEvent.CUSTOMITEM_SHOWNOTIFY, dfi.getForm());
+ LCDUIEvent event = eventDispatcher.newEvent(LCDUIEvent.CUSTOMITEM_SHOWNOTIFY, formLayouter.getForm());
event.item = item;
eventDispatcher.postEvent(event);
CustomItem customItem = (CustomItem) item;
@@ -373,7 +373,7 @@
void eswtHandleHide(Item item)
{
EventDispatcher eventDispatcher = EventDispatcher.instance();
- LCDUIEvent event = eventDispatcher.newEvent(LCDUIEvent.CUSTOMITEM_HIDENOTIFY, dfi.getForm());
+ LCDUIEvent event = eventDispatcher.newEvent(LCDUIEvent.CUSTOMITEM_HIDENOTIFY, formLayouter.getForm());
event.item = item;
eventDispatcher.postEvent(event);
}
@@ -445,7 +445,7 @@
// the paint callback has been executed.
EventDispatcher eventDispatcher = EventDispatcher.instance();
LCDUIEvent event = eventDispatcher.newEvent(
- LCDUIEvent.CUSTOMITEM_PAINT_NATIVE_REQUEST, dfi.getForm());
+ LCDUIEvent.CUSTOMITEM_PAINT_NATIVE_REQUEST, formLayouter.getForm());
event.x = pe.x;
event.y = pe.y;
event.width = pe.width;
@@ -473,7 +473,7 @@
public void mouseDown(MouseEvent event)
{
EventDispatcher eventDispatcher = EventDispatcher.instance();
- LCDUIEvent e = eventDispatcher.newEvent(LCDUIEvent.CUSTOMITEM_POINTERPRESSED, dfi.getForm());
+ LCDUIEvent e = eventDispatcher.newEvent(LCDUIEvent.CUSTOMITEM_POINTERPRESSED, formLayouter.getForm());
e.item = customItem;
e.x = event.x;
e.y = event.y;
@@ -513,7 +513,7 @@
}
}
EventDispatcher eventDispatcher = EventDispatcher.instance();
- LCDUIEvent e = eventDispatcher.newEvent(LCDUIEvent.CUSTOMITEM_POINTERRELEASED, dfi.getForm());
+ LCDUIEvent e = eventDispatcher.newEvent(LCDUIEvent.CUSTOMITEM_POINTERRELEASED, formLayouter.getForm());
e.item = customItem;
e.x = pointerUpX;
e.y = pointerUpY;
@@ -526,7 +526,7 @@
if(disableTapDetection || (!suppressDragEvent) || !checkWithinRect(event.x, event.y))
{
EventDispatcher eventDispatcher = EventDispatcher.instance();
- LCDUIEvent e = eventDispatcher.newEvent(LCDUIEvent.CUSTOMITEM_POINTERDRAGGED, dfi.getForm());
+ LCDUIEvent e = eventDispatcher.newEvent(LCDUIEvent.CUSTOMITEM_POINTERDRAGGED, formLayouter.getForm());
e.item = customItem;
e.x = event.x;
e.y = event.y;
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/DateField.java Fri Jul 23 12:27:20 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/DateField.java Thu Aug 05 16:07:57 2010 +0300
@@ -25,7 +25,6 @@
*/
public class DateField extends Item
{
-
/**
* Input mode that displays only date.
*/
@@ -41,6 +40,13 @@
*/
public static final int DATE_TIME = 3;
+ /**
+ * If DateField is changed, reasons for Re-layouting.
+ */
+ static final int UPDATE_DATE = UPDATE_ITEM_MAX << 1;
+ static final int UPDATE_INPUTMODE = UPDATE_ITEM_MAX << 2;
+
+
private Date date;
private int mode;
@@ -102,7 +108,7 @@
calendar.set(Calendar.SECOND,0);
calendar.set(Calendar.MILLISECOND,0);
}
- return calendar.getTime();//date;
+ return calendar.getTime();
}
/**
@@ -113,7 +119,7 @@
public void setDate(Date newDate)
{
internalSetDate(newDate);
- updateParent(UPDATE_CONTENT);
+ updateParent((newDate == null ? UPDATE_DATE | UPDATE_SIZE_CHANGED : UPDATE_DATE));
}
/**
@@ -143,8 +149,12 @@
throw new IllegalArgumentException(
MsgRepository.DATEFIELD_EXCEPTION_INVALID_MODE);
}
- mode = inputMode;
- updateParent(UPDATE_SIZE_CHANGED);
+
+ if(getInputMode() != inputMode)
+ {
+ mode = inputMode;
+ updateParent(UPDATE_INPUTMODE | UPDATE_SIZE_CHANGED);
+ }
}
/**
@@ -208,12 +218,16 @@
}
else
{
+ calendar.set(Calendar.SECOND,0);
+ calendar.set(Calendar.MILLISECOND,0);
date = calendar.getTime();
}
break;
case DATE:
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
+ calendar.set(Calendar.SECOND,0);
+ calendar.set(Calendar.MILLISECOND,0);
date = calendar.getTime();
break;
case DATE_TIME:
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/DateFieldLayouter.java Fri Jul 23 12:27:20 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/DateFieldLayouter.java Thu Aug 05 16:07:57 2010 +0300
@@ -16,15 +16,18 @@
*/
package javax.microedition.lcdui;
+import java.util.Date;
import java.util.Calendar;
-import org.eclipse.ercp.swt.mobile.DateEditor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.ercp.swt.mobile.DateEditor;
+import org.eclipse.ercp.swt.mobile.CaptionedControl;
+
/**
* Super class for all DateField Layouters. Contains their common
@@ -36,41 +39,38 @@
/**
* Key name for modify listener.
*/
- private static final String MODIFY_LISTENER = "modify";
-
- private static DateEditor staticDate;
+ private static final String MODIFY_LISTENER = "ModifyListener";
/**
* Constructor.
*
- * @param dflp DefaultFormLayoutPolicy used for layouting.
+ * @param aFormLayouter FormLayouter used for layouting.
*/
- DateFieldLayouter(DefaultFormLayoutPolicy dflp)
+ DateFieldLayouter(FormLayouter aFormLayouter)
{
- super(dflp);
+ super(aFormLayouter);
}
/**
- * Get static eSWT DateEditor widget for size calculations.
+ * Creates the eSWT Control for this item.
+ *
+ * @param parent where to create.
+ * @param item DateField Item.
+ * @return Control.
*/
- static DateEditor eswtGetStaticDate()
+ Control eswtGetControl(Composite parent, Item item)
{
- if(staticDate == null)
- {
- staticDate = new DateEditor(eswtGetStaticShell(), SWT.NONE,
- DateEditor.DATE_TIME | DateEditor.COMPACT);
- }
- return staticDate;
+ return eswtCreateControl(parent, item);
}
/**
- * Creates the eSWT control.
+ * Creates the eSWT Control for this item.
*
* @param parent where to create.
- * @param item on which it is based. Must be DateField.
+ * @param item DateField Item.
* @return Control.
*/
- Control eswtGetControl(Composite parent, Item item)
+ static Control eswtCreateControl(Composite parent, Item item)
{
DateField dateField = (DateField) item;
DateEditor dateEditor = null;
@@ -101,7 +101,8 @@
{
dateEditor.setDate(dateField.getDate());
}
- return dateEditor;
+ parent.pack();
+ return parent;
}
/**
@@ -109,12 +110,16 @@
*/
void eswtAddSpecificListeners(Item item, Control control)
{
- super.eswtAddSpecificListeners(item, control);
- DateField dateField = (DateField) item;
- DateEditor de = (DateEditor) control;
- ModifyListener listener = new DateEditorModifyListener(dateField);
- de.addModifyListener(listener);
- de.setData(MODIFY_LISTENER, listener);
+ DateEditor dateEditor = (DateEditor) control;
+ ModifyListener listener = (ModifyListener)dateEditor.getData(MODIFY_LISTENER);
+ if(listener == null)
+ {
+ super.eswtAddSpecificListeners(item, control);
+ DateField dateField = (DateField) item;
+ listener = new DateEditorModifyListener(dateField);
+ dateEditor.addModifyListener(listener);
+ dateEditor.setData(MODIFY_LISTENER, listener);
+ }
}
/**
@@ -122,13 +127,13 @@
*/
void eswtRemoveSpecificListeners(Item item, Control control)
{
- super.eswtRemoveSpecificListeners(item, control);
- DateEditor de = (DateEditor) control;
- ModifyListener listener = (ModifyListener) de.getData(MODIFY_LISTENER);
+ DateEditor dateEditor = (DateEditor) control;
+ ModifyListener listener = (ModifyListener)dateEditor.getData(MODIFY_LISTENER);
if(listener != null)
{
- de.removeModifyListener(listener);
- de.setData(MODIFY_LISTENER, null);
+ super.eswtRemoveSpecificListeners(item, control);
+ dateEditor.removeModifyListener(listener);
+ dateEditor.setData(MODIFY_LISTENER, null);
}
}
@@ -143,20 +148,80 @@
/**
* Updates the values of DateField.
*/
- void eswtUpdateItem(Item item, Control control, int reason, Object param)
+ void eswtUpdateItem(Item item, Control control, int aReason, Object param)
{
- DateField dateField = (DateField) item;
- DateEditor dateEditor = (DateEditor) control;
+ if(!(control instanceof CaptionedControl))
+ {
+ return;
+ }
+
+ DateField dateField = (DateField)item;
+ int reason = aReason & Item.UPDATE_SIZE_MASK;
+
+ switch(reason)
+ {
+ case Item.UPDATE_NONE:
+ break;
+
+ case Item.UPDATE_LABEL:
+ {
+ String label = dateField.getLabel();
+ if(label == null)
+ {
+ label = "";
+ }
+
+ ((CaptionedControl)control).setText(label);
+ control.pack();
+ break;
+ }
+
+ case DateField.UPDATE_DATE:
+ {
+ Control ctrl = eswtFindSpecificControl(dateField, control);
+
+ if(ctrl instanceof DateEditor)
+ {
+ DateEditor dateEditor = (DateEditor)ctrl;
+ Date date = dateField.getDate();
- if(dateField.getDate() != null)
- {
- dateEditor.setDate(dateField.getDate());
- }
+ if(date != null)
+ {
+ if(dateField.getTimeZone() != null)
+ {
+ dateEditor.setTimeZone(dateField.getTimeZone());
+ }
+ dateEditor.setDate(date);
+ }
+ else
+ {
+ //It is expected that on dispose of DateEditor it will remove ModifyListener.
+ dateEditor.dispose();
+ eswtGetControl((CaptionedControl)control, item);
+ }
+ }
+ break;
+ }
- if(dateField.getTimeZone() != null)
- {
- dateEditor.setTimeZone(dateField.getTimeZone());
- }
+ case DateField.UPDATE_INPUTMODE:
+ {
+ Control ctrl = eswtFindSpecificControl(dateField, control);
+
+ if(ctrl instanceof DateEditor)
+ {
+ DateEditor dateEditor = (DateEditor)ctrl;
+ //It is expected that on dispose of DateEditor it will remove ModifyListener.
+ dateEditor.dispose();
+ eswtGetControl((CaptionedControl)control, item);
+ }
+ break;
+ }
+
+ default:
+ {
+ break;
+ }
+ }
}
/**
@@ -169,7 +234,7 @@
{
if(key == SWT.ARROW_LEFT || key == SWT.ARROW_RIGHT)
{
- return true;
+ //return true;
}
return false;
}
@@ -182,18 +247,25 @@
*/
static Point calculateMinimumBounds(final DateField datefield)
{
- final Point minSize = new Point(0, 0);
+ final Point minSize = new Point(0, 0);
ESWTUIThreadRunner.syncExec(new Runnable()
{
public void run()
{
- DateEditor tempEditor = eswtGetStaticDate();
- minSize.x = getMaximumItemWidth(datefield);
- minSize.y = tempEditor.computeSize(minSize.x, SWT.DEFAULT).y;
- applyMinMargins(datefield, minSize);
+ CaptionedControl captioned = new CaptionedControl(eswtGetStaticShell(), SWT.VERTICAL);
+ if(datefield.hasLabel())
+ {
+ captioned.setText(MIN_TEXT);
+ }
+ eswtCreateControl(captioned, datefield);
+ int maxWidth = getMaximumItemWidth(datefield);
+ Point size = captioned.computeSize(maxWidth, SWT.DEFAULT);
+ captioned.dispose();
+ minSize.x = size.x;
+ minSize.y = size.y;
}
});
- return minSize;
+ return minSize;
}
/**
@@ -203,22 +275,27 @@
* @return Preferred area needed to display Item. x is width and y is
* height.
*/
- static Point calculatePreferredBounds(Item item)
+ static Point calculatePreferredBounds(final DateField datefield)
{
- final Point prefSize = new Point(0, 0);
- final DateField datefield = (DateField) item;
+ final Point prefSize = new Point(0, 0);
ESWTUIThreadRunner.syncExec(new Runnable()
{
public void run()
{
- DateEditor tempEditor = eswtGetStaticDate();
- prefSize.x = getMaximumItemWidth(datefield);
- prefSize.y = tempEditor.computeSize(prefSize.x, SWT.DEFAULT).y;
- applyPrefMargins(datefield, prefSize);
+ CaptionedControl captioned = new CaptionedControl(eswtGetStaticShell(), SWT.VERTICAL);
+ if(datefield.hasLabel())
+ {
+ captioned.setText(datefield.getLabel());
+ }
+ eswtCreateControl(captioned, datefield);
+ int maxWidth = getMaximumItemWidth(datefield);
+ Point size = captioned.computeSize(maxWidth, SWT.DEFAULT);
+ captioned.dispose();
+ prefSize.x = size.x;
+ prefSize.y = size.y;
}
});
- return prefSize;
- // return calculateMinimumBounds((DateField) item);
+ return prefSize;
}
/**
@@ -226,30 +303,29 @@
*/
class DateEditorModifyListener implements ModifyListener
{
-
private DateField dateField;
/**
- * Constructor.
- * @param dateField DateField to be updated.
- */
+ * Constructor.
+ * @param dateField DateField to be updated.
+ */
public DateEditorModifyListener(DateField dateField)
{
this.dateField = dateField;
}
/**
- * Called by eSWT when DateEditor's value is modified.
- *
- * @param e Event.
- */
+ * Called by eSWT when DateEditor's value is modified.
+ *
+ * @param e Event.
+ */
public void modifyText(ModifyEvent e)
{
// Actions needed only if value is adjusted. Compare values
// depending of dateField's type and exit if values are same.
if(!isEqualDate(dateField, (DateEditor) e.getSource()))
{
- Logger.method(dateField, "modify", e);
+ Logger.method(dateField, MODIFY_LISTENER, e);
dateField.internalSetDate(((DateEditor) e.getSource()).getDate());
// notify item state listener
dateField.notifyStateChanged();
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/DefaultFormInteraction.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,652 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-package javax.microedition.lcdui;
-
-import java.util.Timer;
-import java.util.TimerTask;
-
-import org.eclipse.swt.SWT;
-
-/**
- * Responsible for implementing interaction in DefaultFormLayoutPolicy.
- */
-class DefaultFormInteraction extends DefaultFormLayoutPolicy
-{
-
- private static final int NO_DIRECTION = -1;
-
- private Item currentSelectedItem;
-
- private int direction = NO_DIRECTION;
-
- private boolean mousePressed;
-
- private LayoutObject currentlyUnderMouse;
-
- /**
- * Constructor.
- *
- * @param form where DFLP is applied.
- */
- DefaultFormInteraction(Form form)
- {
- super(form);
- }
-
- final void handleShowCurrentEvent()
- {
- super.handleShowCurrentEvent();
- eswtApplyCurrentFocus();
- }
-
- final void handleHideCurrentEvent()
- {
- super.handleHideCurrentEvent();
- direction = NO_DIRECTION;
- }
-
- /* (non-Javadoc)
- * @see DefaultFormLayoutPolicy#eswtLayoutForm(int)
- */
- final void eswtLayoutForm(int startIndex)
- {
- super.eswtLayoutForm(startIndex);
-
- // clear invalid selected item
- eswtCheckCurrentSelectedItem();
-
- if(currentSelectedItem != null
- && (currentSelectedItem.isFocusable()))
- {
- eswtApplyCurrentFocus();
- }
- else
- {
- // If there's no item currently selected try to find first
- // focusable item and set it current (if found):
- Item found = eswtGetNextFocusableItem(
- getItem(startIndex - 1), SWT.ARROW_RIGHT);
- if(found != null)
- {
- eswtSetCurrentSelectedItem(found, NO_DIRECTION);
- }
- else
- {
- eswtApplyCurrentFocus();
- }
- }
- }
-
- /* (non-Javadoc)
- * @see DefaultFormLayoutPolicy#eswtSetCurrentItem(Item)
- */
- boolean eswtSetCurrentItem(Item item)
- {
- boolean ret = super.eswtSetCurrentItem(item);
- if(ret && item != null && item.isFocusable())
- {
- eswtSetCurrentSelectedItem(item, NO_DIRECTION);
- Logger.info("eswtSetCurrentItem" + item);
- }
- return ret;
- }
-
- /**
- * DefaultFormInteraction handler for key events.<br>
- * The DefaultFormInteraction is responsible to react to key presses
- * accordingly. The implementation moves focus and/or scrolls the form when
- * needed. The method is called by the Form.
- *
- * @param keyCode eSWT key code.
- * @param keyType eSWT key type.
- */
- final void handleKeyEvent(int keyCode, int keyType)
- {
- Logger.method(this, "handleKeyEvent", currentSelectedItem,
- String.valueOf(keyCode), String.valueOf(keyType));
-
- boolean isDirectionalKey = isDirectionKey(keyCode);
- if(keyType == SWT.KeyDown && isDirectionalKey)
- {
- eswtCheckCurrentSelectedItem();
- }
-
- if(currentSelectedItem != null)
- {
- if(getLayouter(currentSelectedItem).eswtOfferKeyEvent(
- currentSelectedItem, keyCode, keyType))
- {
- // if the key has been consumed
- return;
- }
- }
-
- // scrolling/focus traverse only happens on directional key's down event
- if(keyType == SWT.KeyDown && isDirectionalKey)
- {
- // try to find next focusable item
- Item next = eswtGetNextFocusableItem(currentSelectedItem, keyCode);
-
- // if no visible & focusable item was found to transfer focus
- if(next == currentSelectedItem)
- {
- // try to scroll a bit
- eswtSetScrollingPosition(getNextScrollingPosition(keyCode),
- true);
- // find next focusable after scrolling
- next = eswtGetNextFocusableItem(currentSelectedItem, keyCode);
- }
-
- if(next != currentSelectedItem)
- {
- //textfield always have to be fully visible when focused.
- if(next instanceof TextField)
- {
- eswtScrollToItem(next);
- }
- eswtSetCurrentSelectedItem(next, keyCode);
- }
- }
- }
-
- /**
- * Returns if the parameter is a eSWT directional key code.
- *
- * @param keyCode key code
- */
- private boolean isDirectionKey(int keyCode)
- {
- return (keyCode == SWT.ARROW_DOWN || keyCode == SWT.ARROW_UP
- || keyCode == SWT.ARROW_LEFT || keyCode == SWT.ARROW_RIGHT);
- }
-
- /**
- * DefaultFormInteraction handler for pointer events.<br>
- * The method is called by the Form.
- *
- * @param x coordinate relative to scrolledComposite
- * @param y coordinate relative to scrolledComposite
- * @param type event type: SWT.MouseDown, SWT.MouseMove, SWT.MouseUp
- */
- final void handlePointerEvent(int x, int y, int type)
- {
- Logger.method(this, "handlePointerEvent", String.valueOf(x),
- String.valueOf(y), String.valueOf(type));
-
- // TODO: change when DirectUI style arrives.
- /*
- Item item;
- if (type == SWT.MouseMove) {
- if (currentlyUnderMouse == null
- || !currentlyUnderMouse.contains(x, y)) {
- if (currentlyUnderMouse != null) {
- //currentlyUnderMouse.getControl().setCapture(false);
- }
- item = eswtFindItemUnderMouse(x, y);
- if (item != null && item != currentSelectedItem
- && item.isFocusable()) {
- setCurrentItem(item);
- item.internalSetFocused(true);
- eswtSetCurrentSelectedItem(item);
- //following method causes all mouse events delivered to it
-
- currentlyUnderMouse.getControl().setCapture(true);
- Logger.warning("seting capture to:" + item);
- }
- }
- int currentVPosition = getVPosition();
- boolean isMouseDirectionUp = false;
- boolean doScrolling = false;
- int localY = y;
-
- if (y <= currentVPosition) {
- localY = Math.max(0, y);
- eswtSetScrollingPosition(localY, true);
- isMouseDirectionUp = true;
- doScrolling = true;
- }
- else if (y > (currentVPosition + getFormHeight())) {
- //check for maxVPosition
- if (y > (eswtGetMaxVPosition() + getFormHeight())) {
- localY = eswtGetMaxVPosition() + getFormHeight();
- }
- else {
- localY = y;
- }
- currentVPosition = localY - getFormHeight();
- eswtSetScrollingPosition(currentVPosition, true);
-
- isMouseDirectionUp = false;
- doScrolling = true;
- }
- if (mousePressed && doScrolling) {
- resetEventTimer(isMouseDirectionUp, localY);
- }
- }
- else
- if (type == SWT.MouseDown) {
- mousePressed = true;
- item = eswtFindItemUnderMouse(x, y);
- if (item != null && item != currentSelectedItem
- && item.isFocusable() && getForm().getShell() ==
- getForm().getShell().getDisplay().getActiveShell()) {
- //eswtScrollToItem(item);
- //following method causes all mouse events delivered to it
-
- //currentlyUnderMouse.getControl().setCapture(true);
- }
- }
- else if (type == SWT.MouseUp) {
- mousePressed = false;
- if (currentlyUnderMouse != null) {
- //currentlyUnderMouse.getControl().setCapture(false);
- }
- }*/
- }
-
- /**
- * Find item at the specified point.
- *
- * @param x coordinate.
- * @param y coordinate.
- * @return Item.
- */
- Item eswtFindItemUnderMouse(int x, int y)
- {
- Row itemRow;
- for(int i = 0; i < getRowCount(); i++)
- {
- itemRow = getRow(i);
- if(itemRow.getYShift() <= y && y <= itemRow.getBottomPosition())
- {
- LayoutObject lo;
- for(int j = 0; j < itemRow.size(); j++)
- {
- lo = itemRow.getLayoutObject(j);
- if(lo.contains(x, y))
- {
- Logger.info("Item under mouse: "
- + lo.getOwningItem());
- currentlyUnderMouse = lo;
- return lo.getOwningItem();
- }
- }
- break;
- }
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see DefaultFormLayoutPolicy#eswtHandleVisibilityChanges()
- */
- protected void eswtHandleVisibilityChanges()
- {
- super.eswtHandleVisibilityChanges();
- eswtCheckCurrentSelectedItem();
- }
-
- /**
- * Gets next (or nearest) focusable item.
- *
- * @param fromItem Item where to start to search the next focusable item.
- * @param dir Search direction, one of the arrow key constants defined
- * in class SWT.
- *
- * @return Nearest focusable item or null if no item found.
- */
- final Item eswtGetNextFocusableItem(Item fromItem, int dir)
- {
- Item nextItem = fromItem;
-
- switch(dir)
- {
- case SWT.ARROW_RIGHT:
- {
- LayoutObject obj = getLastLayoutObjectOfItem(fromItem);
- while((obj = getNextLayoutObjectOfItem(obj, null)) != null)
- {
- Item owner = obj.getOwningItem();
- if(owner != null && owner != fromItem
- && owner.isFocusable()
- && isPartiallyVisible(obj, Config.DFI_VISIBILITY_PERCENT))
- {
- nextItem = owner;
- break;
- }
- }
- break;
- }
-
- case SWT.ARROW_LEFT:
- {
- LayoutObject obj = getFirstLayoutObjectOfItem(fromItem);
- while((obj = getPrevLayoutObjectOfItem(obj, null)) != null)
- {
- Item owner = obj.getOwningItem();
- if(owner != null && owner != fromItem
- && owner.isFocusable()
- && isPartiallyVisible(obj, Config.DFI_VISIBILITY_PERCENT))
- {
- nextItem = owner;
- break;
- }
- }
- break;
- }
-
- case SWT.ARROW_DOWN:
- {
- int minDist = Integer.MAX_VALUE;
- LayoutObject start = getLastLayoutObjectOfItem(fromItem);
- LayoutObject obj = start;
- while((obj = getNextLayoutObjectOfItem(obj, null)) != null)
- {
- Item owner = obj.getOwningItem();
- if(owner != null && owner != fromItem
- && owner.isFocusable() && obj.isBelow(start)
- && isPartiallyVisible(obj, Config.DFI_VISIBILITY_PERCENT))
- {
- int dist = obj.distanceTo(start);
- if(dist < minDist)
- {
- minDist = dist;
- nextItem = owner;
- }
- }
- }
- break;
- }
-
- case SWT.ARROW_UP:
- {
- int minDist = Integer.MAX_VALUE;
- LayoutObject start = getFirstLayoutObjectOfItem(fromItem);
- LayoutObject obj = start;
- while((obj = getPrevLayoutObjectOfItem(obj, null)) != null)
- {
- Item owner = obj.getOwningItem();
- if(owner != null && owner != fromItem
- && owner.isFocusable() && obj.isAbove(start)
- && isPartiallyVisible(obj, Config.DFI_VISIBILITY_PERCENT))
- {
- int dist = obj.distanceTo(start);
- if(dist < minDist)
- {
- minDist = dist;
- nextItem = owner;
- }
- }
- }
- break;
- }
-
- default:
- }
-
- return nextItem;
- }
-
- /**
- * Check if the currentSelectedItem is valid and visible. If not then it
- * sets it to null.
- */
- final void eswtCheckCurrentSelectedItem()
- {
- if(currentSelectedItem != null)
- {
- if(currentSelectedItem.getParent() != getForm()
- || !currentSelectedItem.isVisible())
- {
- // we need to find another
- Logger.method(this, "eswtCheckCurrentSelectedItem");
- eswtSetCurrentSelectedItem(null, NO_DIRECTION);
- }
- }
- }
-
- /**
- * Sets currentSelectedItem and sets focus to it.<br>
- * If one of form's items is already selected when this method is called,
- * removes focus from old item and then moves focus to new one.
- *
- * @param item Item to set as current selected. If null, nothing happens.
- * @param dir Direction which is delivered to layouter.
- */
- void eswtSetCurrentSelectedItem(Item item, int dir)
- {
- if(currentSelectedItem != item)
- {
- Logger.info(this + "::SelectedItem: "
- + currentSelectedItem + " --(" + dir + ")--> " + item);
-
- // Save direction
- direction = dir;
- // Remove focus from currentSelectedItem and notify its Layouter.
- if(currentSelectedItem != null)
- {
- getLayouter(currentSelectedItem).eswtFocusLost(
- currentSelectedItem);
- }
-
- // Set new currentSelectedItem, must be focusable or null
- currentSelectedItem = item;
-
- // Set focus to currentSelectedItem and notify its Layouter.
- if(currentSelectedItem != null)
- {
- getLayouter(currentSelectedItem).eswtFocusGained(
- currentSelectedItem, dir);
- }
-
- // Apply eSWT focus to currentSelectedItem's control
- eswtApplyCurrentFocus();
- }
- }
-
- /**
- * Sets currentSelectedItem and sets focus to it.<br>
- * If one of form's items is already selected when this method is called,
- * removes focus from old item and then moves focus to new one.
- *
- * @param item Item to set as current selected. If null, nothing happens.
- * @param dir Direction which is delivered to layouter.
- */
- void eswtSetCurrentSelectedItem(Item item)
- {
- if(currentSelectedItem != item)
- {
- Logger.info(this + "::SelectedItem: "
- + currentSelectedItem + " ---> " + item);
-
- // Remove focus from currentSelectedItem and notify its Layouter.
- if(currentSelectedItem != null)
- {
- getLayouter(currentSelectedItem).eswtFocusLost(
- currentSelectedItem);
- }
-
- // Set new currentSelectedItem, must be focusable or null
- currentSelectedItem = item;
-
- // Set focus to currentSelectedItem and notify its Layouter.
- if(currentSelectedItem != null)
- {
- getLayouter(currentSelectedItem).eswtFocusGained(
- currentSelectedItem, NO_DIRECTION);
- }
-
- // Apply eSWT focus to currentSelectedItem's control
- //eswtApplyCurrentFocus();
- }
- }
-
- /**
- * Sets focus to currentSelectedItem's control if its partially visible.
- * Otherwise it sets dummy focus to form's composite.<br>
- * <br>
- * Note that this method applies focus only to eSWT control. Item focus
- * update and layouter notifications are handled in method
- * <code>eswtSetCurrentSelectedItem()</code>.<br>
- * If currentSelectedItem is null or form is not shown, this method has no
- * effect.
- */
- void eswtApplyCurrentFocus()
- {
- if(isFormCurrent())
- {
- // if any of the Item's LayoutObjects is visible
- if(isItemPartiallyVisible(currentSelectedItem))
- {
- Logger.method(this, "ApplyFocus", currentSelectedItem);
- eswtSetFocusToFirstControl(currentSelectedItem);
- }
- else
- {
- Logger.method(this, "ApplyFocus", "dummy");
- formComposite.forceFocus();
- }
- }
- }
-
- /**
- * If the Item is valid and it is layouted, then sets the Item's first
- * LayoutObject focused.
- *
- * @param item an item which first LayoutObject is set focused.
- */
- void eswtSetFocusToFirstControl(Item item)
- {
- if(item != null && item.isFocusable())
- {
- LayoutObject lo = getFirstLayoutObjectOfItem(item);
- if(lo != null)
- {
- lo.getControl().forceFocus();
- }
- }
- }
-
- /**
- * Gets Current selected item.
- *
- * @return Current selected item. May also return null.
- */
- Item getCurrentSelectedItem()
- {
- return currentSelectedItem;
- }
-
- /**
- * Get the direction of scrolling.
- *
- * @return direction of scrolling.
- */
- int getDirection()
- {
- return direction;
- }
-
- /* (non-Javadoc)
- * @see DefaultFormLayoutPolicy#eswtResizeItemAndShift(Item)
- */
- int eswtResizeItemAndShift(Item item)
- {
- // save the state of the last row before resizing and Shifting.
- boolean itemWasVisible = isItemPartiallyVisible(item);
-
- int newVPosition = super.eswtResizeItemAndShift(item);
-
- if(item == currentSelectedItem)
- {
- if(itemWasVisible)
- {
- int itemTop = getItemTopPosition(item);
- int itemBottom = getItemBottomPosition(item);
- // currentSelectedItem has to be focused if it was focused
- // before resizing e.g TextField when it is resized by adding a
- // new row and it was in the bottom of the Screen.
- if(newVPosition <= itemTop
- && (newVPosition + getFormHeight()) >= itemBottom)
- {
- // do not change vPosition;
- }
- else if(newVPosition > itemTop)
- {
- newVPosition = itemTop;
- }
- else if((newVPosition + getFormHeight()) < itemBottom)
- {
- newVPosition = itemBottom - getFormHeight();
- }
- }
- }
- return newVPosition;
- }
-
- private Timer eventTimer = new Timer();
- private EventGeneratorTask eventTask;
-
- /**
- * Reset timer for do layout with a given start index.
- */
- private void resetEventTimer(boolean directionUp, int y)
- {
- if(eventTimer != null)
- {
- if(eventTask != null)
- {
- eventTask.cancel();
- eventTask = null;
- }
- // schedule new timer
- eventTask = new EventGeneratorTask(directionUp, y);
- eventTimer.schedule(eventTask, Config.DFI_EVENT_TIMER_DELAY);
- }
- }
-
- /**
- * Form Timer task. Triggers the formComposite to Layout.
- */
- class EventGeneratorTask extends TimerTask
- {
-
- private boolean isUpDirection;
- private int localY;
-
- public EventGeneratorTask(boolean direction, int y)
- {
- isUpDirection = direction;
- localY = y;
- Logger.info("y is " + localY);
- }
-
- public void run()
- {
- if(isUpDirection)
- {
- localY -= Config.DFI_EVENT_MOVE_DELTA;
- }
- else
- {
- localY += Config.DFI_EVENT_MOVE_DELTA;
- }
- handlePointerEvent(0, localY, SWT.MouseMove);
- }
- }
-
-}
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/DefaultFormLayoutPolicy.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1433 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-package javax.microedition.lcdui;
-
-import java.util.NoSuchElementException;
-import java.util.Vector;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-/**
- * DefaultFormLayoutPolciy implements form layout algorithm.
- */
-class DefaultFormLayoutPolicy extends FormLayoutPolicy
-{
-
- /**
- * Form instance (not owned).
- */
- private Form form;
-
- /**
- * Form's scrolled composite (not owned).
- */
- protected ScrolledComposite formComposite;
-
- /**
- * Rows vector.
- */
- private Vector rows = new Vector();
-
- /**
- * Form's current horizontal alignment
- */
- private int currentHLayoutDirective;
-
- private ImageItemLayouter imIL;
-
- private StringItemLayouter sIL;
-
- private GaugeLayouter gL;
-
- private TextFieldLayouter tfL;
-
- private DateFieldLayouter dfL;
-
- private ChoiceGroupLayouter cgL;
-
- private CustomItemLayouter ciL;
-
- private SpacerLayouter sL;
-
- private int vPosition;
-
- private Item deferredScrollToItem;
-
- private boolean isCurrent;
-
- // Used by getItemControl() method to return Item's main conrol.
- private Control itemMainControl;
-
- /**
- * Constructor.
- *
- * @param form Form to perform layout on.
- */
- DefaultFormLayoutPolicy(Form form)
- {
- this.form = form;
- formComposite = form.getFormComposite();
- imIL = new ImageItemLayouter(this);
- sIL = new StringItemLayouter(this);
- gL = new GaugeLayouter(this);
- dfL = new DateFieldLayouter(this);
- tfL = new TextFieldLayouter(this);
- cgL = new ChoiceGroupLayouter(this);
- ciL = new CustomItemLayouter(this);
- sL = new SpacerLayouter(this);
- }
-
- /**
- * Dispose and cleanup layouted items.
- */
- void dispose()
- {
- ESWTUIThreadRunner.syncExec(new Runnable()
- {
- public void run()
- {
- eswtClearRows(0, null);
- }
- });
- }
-
- /**
- * Log out a control with all its children at the given indentation level.
- */
- void logControl(int level, Control control)
- {
- if(control != null)
- {
- String s2 = control.toString();
- s2 = s2.substring(0, s2.indexOf('}') - 1);
- String s3 = control.getBounds().toString();
- s3 = s3.substring(s3.indexOf('{'));
- Logger.verbose(Logger.indent(s2 + s3, level * 2));
- if(control instanceof Composite)
- {
- Control[] arr = ((Composite) control).getChildren();
- for(int i = 0; i < arr.length; i++)
- {
- logControl(level + 1, arr[i]);
- }
- }
- }
- }
-
- /**
- * Log out all layoutobjects for each item.
- */
- void logFormLayout()
- {
- Logger.verbose(form + " ---------------------------------------------");
- LayoutObject lo = null;
- Item item = null;
- int line = -1;
- while((lo = getNextLayoutObjectOfItem(lo, null)) != null)
- {
- if(lo.getOwningItem() != item)
- {
- item = lo.getOwningItem();
- Logger.verbose(item.toString());
- }
- if(lo.getRowIdx() != line)
- {
- line = lo.getRowIdx();
- }
- Logger.verbose(Logger.indent("Row:" + lo.getRowIdx(), 2));
- logControl(2, lo.getControl());
- }
- Logger.verbose(form + " ---------------------------------------------");
- }
-
- /**
- * Called when Form is about to be shown.<br>
- * NOTE: this is called from eSWT UI-thread
- */
- void handleShowCurrentEvent()
- {
- Logger.method(this, "handleShowCurrentEvent");
- isCurrent = true;
-
- // restore our scrolling position (eSWT resets it to 0 by default)
- eswtSetScrollingPosition(vPosition, true);
-
- Item item = null;
- LayoutObject lo = null;
- while((lo = getNextLayoutObjectOfItem(lo, null)) != null)
- {
- if(lo.getOwningItem() != item)
- {
- // item border
- item = lo.getOwningItem();
- getLayouter(item).eswtAddListeners(item, lo);
- }
- }
- }
-
- /**
- * Called when Form is about to be hidden.<br>
- * NOTE: this is called from eSWT UI-thread
- */
- void handleHideCurrentEvent()
- {
- Logger.method(this, "handleHideCurrentEvent");
- isCurrent = false;
-
- Item item = null;
- LayoutObject lo = null;
- while((lo = getNextLayoutObjectOfItem(lo, null)) != null)
- {
- if(lo.getOwningItem() != item)
- {
- // item border
- item = lo.getOwningItem();
- getLayouter(item).eswtRemoveListeners(item, lo);
- getLayouter(item).eswtHandleVisibilityChange(item, false);
- }
- }
- }
-
- /**
- * Called when Form is beeing resized.<br>
- * NOTE: this is called from eSWT UI-thread
- */
- void handleResizeEvent(int width, int height)
- {
- // Logger.method(this, "handleResizeEvent");
- int numitems = getItemCount();
- for(int i = 0; i < numitems; i++)
- {
- getItem(i).invalidateCachedSizes();
- }
- ItemLayouter.eswtUpdateStaticShellSize(width, height);
- }
-
- /**
- * Do form layout according to startIndex.
- *
- * @param startItem - index of item which need to be layouted.
- */
- void layoutForm(final int startItem)
- {
- ESWTUIThreadRunner.syncExec(new Runnable()
- {
- public void run()
- {
- eswtLayoutForm(startItem);
- }
- });
- }
-
- /**
- * eSWT callback for doLayout().
- */
- void eswtLayoutForm(int startItem)
- {
- int numItems = getItemCount();
- Logger.method(this, "eswtLayoutForm", startItem + " / " + numItems);
-
- eswtUpdateFormComposite(false);
- if(numItems > 0)
- {
- Item previousItem = null;
- int startRowIndex = 0;
-
- if(startItem > 0)
- {
- // Find row with previous item.
- previousItem = getItem(startItem - 1);
- Row prevItemRow = getLastRowOfItem(previousItem);
- if(prevItemRow != null)
- {
- startRowIndex = rows.indexOf(prevItemRow);
- }
- }
-
- // Clear rows starting from item - partial re-layouting
- eswtClearRows(startRowIndex, previousItem);
-
- // Layout items
- for(int i = startItem; i < numItems; i++)
- {
- eswtLayoutItem(getItem(i));
- }
-
- // Update last row
- eswtUpdateRow(getLastRow());
- }
- else
- {
- eswtClearRows(0, null);
- }
- // check if we need to scroll to a particular item
- if(deferredScrollToItem != null)
- {
- eswtSetCurrentItem(deferredScrollToItem);
- deferredScrollToItem = null;
- }
- eswtUpdateFormComposite(true);
- eswtHandleVisibilityChanges();
-
- if(Logger.isLogVerbose())
- {
- logFormLayout();
- }
- }
-
- void handleKeyEvent(int keyCode, int keyType)
- {
- // Implemented in sub-class DefaultFormInteraction
- }
-
- void handlePointerEvent(int x, int y, int type)
- {
- // Implemented in sub-class DefaultFormInteraction
- }
-
- /**
- * Set focus to an item if it is focusable and scroll form to make it
- * visible if it is not.
- *
- * @param item Item to set as current item.
- */
- void setCurrentItem(final Item item)
- {
- Logger.method(this, "setCurrentItem", item);
- ESWTUIThreadRunner.syncExec(new Runnable()
- {
- public void run()
- {
- eswtSetCurrentItem(item);
- }
- });
- }
-
- /**
- * eSWT callback for setCurrentItem.
- */
- boolean eswtSetCurrentItem(Item item)
- {
- if(item != null)
- {
- if(isItemLayouted(item))
- {
- eswtScrollToItem(item);
- deferredScrollToItem = null;
- return true;
- }
- else
- {
- deferredScrollToItem = item;
- }
- }
- return false;
- }
-
- void eswtScrollToItem(Item item)
- {
- if(item != null)
- {
- int pos = getItemBottomPosition(item) - getFormHeight();
- if(!isItemPartiallyVisible(item))
- {
- eswtSetScrollingPosition(pos, true);
- }
- else if(item instanceof TextField && !isItemFullyVisible(item))
- {
- eswtSetScrollingPosition(pos, true);
- }
- }
- }
-
- void eswtScrolltoRegion(int yTop, int yBottom, int swtDir)
- {
- if(yTop < vPosition || yBottom > vPosition + getFormHeight())
- {
- // if the region is somewhat outside the screen
- if(swtDir == SWT.ARROW_DOWN || swtDir == SWT.ARROW_RIGHT)
- {
- // align to top
- eswtSetScrollingPosition(yTop, true);
- }
- else
- {
- // align to bottom
- eswtSetScrollingPosition(yBottom - getFormHeight(), true);
- }
- }
- }
-
- void eswtScrollIfNeeded(final int top, final int bottom)
- {
- if(bottom > vPosition + getFormHeight())
- {
- eswtSetScrollingPosition(bottom - (getFormHeight() / 2), true);
- }
- else if(top < vPosition)
- {
- eswtSetScrollingPosition(bottom - (getFormHeight() / 2), true);
- }
- }
-
- /**
- * Get control's position relative to composite.
- */
- void getControlPositionOnComposite(Control control, Point location)
- {
- if(control != formComposite)
- {
- Point rel = control.getLocation();
- location.x += rel.x;
- location.y += rel.y;
- getControlPositionOnComposite(control.getParent(), location);
- }
- }
-
- /**
- * eSWT specific calls to do update ScrolledComposite.
- */
- private void eswtUpdateFormComposite(boolean show)
- {
- if(getRowCount() > 0)
- {
- if(show)
- {
- formComposite.updateScrollbar(getLastRow().getBottomPosition());
- formComposite.pack();
- }
- }
- // Could happen if changing item from very tall to very short.
- // so we have to update VPosition
- if(getVPosition() > eswtGetMaxVPosition())
- {
- eswtSetScrollingPosition(eswtGetMaxVPosition(), false);
- }
-
- formComposite.setRedraw(show);
- formComposite.setVisible(show);
- }
-
- /**
- * Clean all form rows starting from startIndex.
- *
- * @param startIndex Start row from which to clean.
- * @param keepItem - item in a startRow which shouldn't be recreated.
- */
- private void eswtClearRows(int startIndex, Item keepItem)
- {
- Logger.method(this, "clearRows", String.valueOf(startIndex), keepItem);
- Row row = null;
- for(int i = (getRowCount() - 1); i >= startIndex; i--)
- {
- row = getRow(i);
- if(row.cleanRow(keepItem))
- {
- break;
- }
- else
- {
- rows.removeElement(row);
- }
- }
-
- // one row always should be available.
- if((getRowCount() == 0))
- {
- // rows.addElement(tempRow);
- currentHLayoutDirective = Item.LAYOUT_DEFAULT;
- Row newRow = new Row(ItemLayouter.getMaximumItemWidth(null),
- getCurrentHLayoutDirective());
- rows.addElement(newRow);
- }
- }
-
- /**
- * Update Row's internal layout. Handles LAYOUT_2 related post-processing.
- *
- * @param row Row
- */
- private void eswtUpdateRow(Row row)
- {
- if(row != null)
- {
- //Logger.verbose("updateRow start: " + row);
- int numShrink = row.getNumLayoutObjects(Item.LAYOUT_SHRINK);
- int numExpand = row.getNumLayoutObjects(Item.LAYOUT_EXPAND);
- //Logger.verbose("shrink: " + numShrink + " expand: " + numExpand);
-
- int vMask = Item.LAYOUT_VSHRINK | Item.LAYOUT_VEXPAND;
- // Expand items vertically with VSHRINK or VEXPAND layout directive
- LayoutObject lo = null;
- int maxHeight = row.getRowHeight(vMask);
- while((lo = row.getNextLayoutObject(lo, vMask)) != null)
- {
- if(lo.getOwningItem().hasLayout(Item.LAYOUT_VSHRINK))
- {
- int pref = lo.getOwningItem().getPreferredHeight();
- getLayouter(lo.getOwningItem()).eswtResizeObject(lo,
- lo.getWidth(), Math.min(pref, maxHeight));
- }
- else if(lo.getOwningItem().hasLayout(Item.LAYOUT_VEXPAND))
- {
- getLayouter(lo.getOwningItem()).eswtResizeObject(lo,
- lo.getWidth(), maxHeight);
- }
- }
-
- // Expand items with SHRINK layout directive
- if(numShrink > 0)
- {
- // Get extra space before shrink and expand
- int offset = row.getFreeSpace() / numShrink;
- // Logger.verbose("shrinkOffset: " + offset);
- if(offset >= 0)
- {
- while((lo = row.getNextLayoutObject(lo, Item.LAYOUT_SHRINK)) != null)
- {
- int pref = lo.getOwningItem().getPreferredWidth();
- int min = lo.getOwningItem().getMinimumWidth();
- int itemWidth = Math.min(pref, min + offset);
- getLayouter(lo.getOwningItem()).eswtResizeObject(lo,
- itemWidth, lo.getHeight());
- }
- }
- }
-
- // Expand items with EXPAND layout directive
- if(numExpand > 0)
- {
- // Get extra space after shrink but before expand
- int offset = row.getFreeSpace(Item.LAYOUT_EXPAND) / numExpand;
- if(offset >= 0)
- {
- // Logger.verbose("expandOffset: " + offset);
- while((lo = row.getNextLayoutObject(lo, Item.LAYOUT_EXPAND)) != null)
- {
- int pref = lo.getOwningItem().getPreferredWidth();
- getLayouter(lo.getOwningItem()).eswtResizeObject(lo,
- pref + offset, lo.getHeight());
- }
- }
- }
-
- //if (numShrink > 0 || numExpand > 0) {
- row.updateRowInternals();
- //}
-
- row.updateRowLayout(form.getLeftRightLanguage());
- // Logger.verbose("updateRow: " + row);
- }
- }
-
- /**
- * Add a new Row.
- */
- private Row eswtAddNewRow()
- {
- Row lastRow = getLastRow();
- eswtUpdateRow(lastRow);
- int yShift = (lastRow == null ? 0 : lastRow.getBottomPosition());
- // create new Row
- Row newRow = new Row(ItemLayouter.getMaximumItemWidth(null),
- getCurrentHLayoutDirective());
- newRow.setYShift(yShift);
- rows.addElement(newRow);
- return newRow;
- }
-
- /**
- * Add a LayoutObject to the last Row.
- *
- * @param layoutObject the layout object
- */
- void eswtAddNewLayoutObject(LayoutObject layoutObject)
- {
- Row lastRow = getLastRow();
- // check if the current Row is full
- if(!lastRow.isEmpty()
- && lastRow.getFreeSpace() < layoutObject.getWidth())
- {
- lastRow = eswtAddNewRow();
- }
- lastRow.eswtAddLayoutObject(layoutObject);
- layoutObject.setRowIdx(getRowCount() - 1);
- }
-
- /**
- * Optionally add a new Row and adds a LayoutObject.
- *
- * @param layoutObject the layout object
- * @param newRow adds a new row if true. If false, adds new row only if
- * there's no space for layoutObject in current row.
- */
- void eswtAddNewLayoutObject(LayoutObject layoutObject, boolean newRow)
- {
- if(newRow)
- {
- eswtAddNewRow();
- }
- eswtAddNewLayoutObject(layoutObject);
- }
-
- /**
- * Layout item in a row, if needed new row is added.
- *
- * @param row - where to startLayout.
- * @param item - Item to Layout
- */
- private void eswtLayoutItem(Item item)
- {
- Row lastRow = getLastRow();
- boolean hlChange = setCurrentHLayoutDirective(item.internalGetLayout());
- if(hlChange || getItemNewLineBefore(item))
- {
- // newline directive or horizontal layout changed
- if(lastRow.isEmpty())
- {
- // if the current/last row is empty - use that
- lastRow.setRowHLayout(getCurrentHLayoutDirective());
- }
- else
- {
- eswtAddNewRow();
- }
- }
-
- // Use the specific layouter to layout item in the last row
- getLayouter(item).eswtLayoutItem(getLastRow(), item);
-
- if(form.eswtIsShown())
- {
- LayoutObject lo = getFirstLayoutObjectOfItem(item);
- if(lo != null)
- {
- getLayouter(item).eswtAddListeners(item, lo);
- }
- }
-
- if(getItemNewLineAfter(item))
- {
- eswtAddNewRow();
- }
- }
-
- /**
- * Set Form's Layout directive. if it differ from current set flag
- * startFromNewLine = true;
- *
- * @param newLayoutDirective
- * @return true if a layout change has occured
- */
- private boolean setCurrentHLayoutDirective(int newLayoutDirective)
- {
- int newHLayoutDirective = Item.getHorizontalLayout(newLayoutDirective);
- if((newHLayoutDirective != currentHLayoutDirective)
- && (newHLayoutDirective != Item.LAYOUT_DEFAULT))
- {
- currentHLayoutDirective = newHLayoutDirective;
- return true;
- }
- return false;
- }
-
- /**
- * Get Form current Layout directive.
- *
- * @return current Layout directive for Form.
- */
- private int getCurrentHLayoutDirective()
- {
- if(currentHLayoutDirective == Item.LAYOUT_DEFAULT)
- {
- return getLanguageSpecificLayoutDirective();
- }
- return currentHLayoutDirective;
- }
-
- /**
- * Returns language specific layout directive.
- *
- * @return LAYOUT_LEFT or LAYOUT_RIGHT.
- */
- int getLanguageSpecificLayoutDirective()
- {
- if(form.getLeftRightLanguage())
- {
- return Item.LAYOUT_LEFT;
- }
- else
- {
- return Item.LAYOUT_RIGHT;
- }
- }
-
- private boolean getItemNewLineBefore(Item item)
- {
- return ((item.internalGetLayout() & Item.LAYOUT_NEWLINE_BEFORE) != 0);
- }
-
- private boolean getItemNewLineAfter(Item item)
- {
- return ((item.internalGetLayout() & Item.LAYOUT_NEWLINE_AFTER) != 0);
- }
-
- boolean isItemLayouted(Item item)
- {
- return (getFirstLayoutObjectOfItem(item) != null);
- }
-
- /**
- * Returns if the form is shown.
- */
- boolean isFormCurrent()
- {
- return isCurrent;
- }
-
- /**
- * Returns if the region is partially visible.
- *
- * @param viewTop viewPort's top position
- * @param viewBottom viewPort's bottom position
- * @return true if visible
- */
- boolean isPartiallyVisible(int yTop, int yBottom)
- {
- int vBottomPosition = vPosition + getFormHeight();
- if((vPosition <= yTop && vBottomPosition <= yTop)
- || (vPosition >= yBottom && vBottomPosition >= yBottom))
- {
- return false;
- }
- return true;
- }
-
- /**
- * Returns if at least the region's given percentage is visible.
- */
- boolean isPartiallyVisible(int yTop, int yBottom, int minPercent)
- {
- int visPercent = getVisibilityPercent(yTop, yBottom);
- if(visPercent > minPercent)
- {
- return true;
- }
- return false;
- }
-
- /**
- * Returns the region's visibility percentage.
- */
- int getVisibilityPercent(int yTop, int yBottom)
- {
- if(yTop >= yBottom)
- {
- return 0;
- }
- int vBottomPosition = vPosition + getFormHeight();
- int r1 = Math.max(vPosition, Math.min(yTop, vBottomPosition));
- int r2 = Math.min(vBottomPosition, Math.max(yBottom, vPosition));
- return ((r2 - r1) * 100) / (yBottom - yTop);
- }
-
- /**
- * Returns if the LayoutObject is partially visible.
- */
- boolean isPartiallyVisible(LayoutObject lo)
- {
- if(lo != null)
- {
- return isPartiallyVisible(lo.getY(), lo.getY() + lo.getHeight());
- }
- return false;
- }
-
- /**
- * Returns if at least the LayoutObject's given percentage is visible.
- */
- boolean isPartiallyVisible(LayoutObject lo, int minPercent)
- {
- if(lo != null)
- {
- return isPartiallyVisible(lo.getY(), lo.getY() + lo.getHeight(),
- minPercent);
- }
- return false;
- }
-
- /**
- * Returns if the Item is partially visible (if one of its LayoutObjects is
- * partially visible).
- *
- * @param item the Item
- * @return true if partially visible
- */
- boolean isItemPartiallyVisible(Item item)
- {
- if(item != null)
- {
- LayoutObject lo = null;
- while((lo = getNextLayoutObjectOfItem(lo, item)) != null)
- {
- if(isPartiallyVisible(lo))
- {
- return true;
- }
- }
- }
- return false;
- }
-
-
-
- /**
- * Returns true if item is fully visible.
- *
- * @param item the Item.
- * @return true if fully visible.
- */
- boolean isItemFullyVisible(Item item)
- {
- if(item != null)
- {
- LayoutObject lo = null;
- while((lo = getNextLayoutObjectOfItem(lo, item)) != null)
- {
- if(!isLOFullyVisible(lo))
- {
- return false;
- }
- }
- }
- return true;
- }
-
- /**
- * Returns if the LayoutObject is fully visible.
- */
- boolean isLOFullyVisible(LayoutObject lo)
- {
- if(lo != null)
- {
- return isFullyVisible(lo.getY(), lo.getY() + lo.getHeight());
- }
- return false;
- }
-
- /**
- * Returns if the region is fully visible.
- *
- * @param viewTop viewPort's top position
- * @param viewBottom viewPort's bottom position
- * @return true if visible
- */
- boolean isFullyVisible(int yTop, int yBottom)
- {
- int vBottomPosition = vPosition + getFormHeight();
- if((vPosition <= yTop && vBottomPosition >= yBottom))
- {
- return true;
- }
- return false;
- }
-
- int getItemTopPosition(Item item)
- {
- LayoutObject lo = getFirstLayoutObjectOfItem(item);
- if(lo != null)
- {
- return lo.getY();
- }
- return 0;
- }
-
- int getItemBottomPosition(Item item)
- {
- LayoutObject lo = getLastLayoutObjectOfItem(item);
- if(lo != null)
- {
- return lo.getY() + lo.getHeight();
- }
- return 0;
- }
-
- int getItemCount()
- {
- return form.size();
- }
-
- Item getItem(int index)
- {
- try
- {
- return (Item) form.getItems().elementAt(index);
- }
- catch(ArrayIndexOutOfBoundsException e)
- {
- // Logger.exception(e);
- return null;
- }
- }
-
- int getItemIndex(Item item)
- {
- return form.getItems().indexOf(item);
- }
-
- int getRowCount()
- {
- return rows.size();
- }
-
- /**
- * Return the Row with the given index.
- *
- * @param index Row's index
- * @return a Row
- */
- Row getRow(int index)
- {
- try
- {
- return (Row) rows.elementAt(index);
- }
- catch(ArrayIndexOutOfBoundsException e)
- {
- Logger.exception("getRow", e);
- return null;
- }
- }
-
- /**
- * Return the Row to which the given LayoutObject belongs.
- *
- * @param lo LayoutObject
- * @return the owning Row
- */
- Row getRow(LayoutObject lo)
- {
- try
- {
- return getRow(lo.getRowIdx());
- }
- catch(NullPointerException e)
- {
- // Logger.exception("getRow", e);
- return null;
- }
- }
-
- /**
- * Returns the last row of the form.
- */
- Row getLastRow()
- {
- try
- {
- return (Row) rows.lastElement();
- }
- catch(NoSuchElementException nse)
- {
- // Logger.exception("getLastRow", nse);
- return null;
- }
- }
-
- /**
- * Find last row which contains corresponding Item.
- *
- * @param item Item in a Row.
- * @return Last Row with that item.
- */
- Row getLastRowOfItem(Item item)
- {
- return getRow(getLastLayoutObjectOfItem(item));
- }
-
- /**
- * Get Form which requires layout.
- *
- * @return form.
- */
- Form getForm()
- {
- return form;
- }
-
- /**
- * Form's content height.
- */
- int getFormHeight()
- {
- return form.getHeight();
- }
-
- /**
- * Form's content width.
- */
- int getFormWidth()
- {
- return form.getWidth();
- }
-
- /**
- * Returns the next LayoutObject belonging to this Item.<br>
- *
- * @param lo starting LayoutObject; if null then it start from first.
- * @param item specifies the parent Item; null means any Item
- * @return the next LayoutObject in the layout.
- */
- LayoutObject getNextLayoutObjectOfItem(LayoutObject lo, Item item)
- {
- int startRow = (lo == null ? 0 : lo.getRowIdx());
- LayoutObject temp = null;
- for(int i = startRow; i < getRowCount(); i++)
- {
- temp = getRow(i).getNextLayoutObject(lo, item);
- if(temp != null && temp != lo)
- {
- return temp;
- }
- }
- return null;
- }
-
- /**
- * Returns the previous LayoutObject belonging to this Item.<br>
- *
- * @param lo starting LayoutObject; if null then it start from last.
- * @param item specifies the parent Item; null means any Item
- * @return the previous LayoutObject in the layout.
- */
- LayoutObject getPrevLayoutObjectOfItem(LayoutObject lo, Item item)
- {
- int startRow = (lo == null ? rows.size() - 1 : lo.getRowIdx());
- LayoutObject temp = null;
- for(int i = startRow; i >= 0; i--)
- {
- temp = getRow(i).getPrevLayoutObject(lo, item);
- if(temp != null && temp != lo)
- {
- return temp;
- }
- }
- return null;
- }
-
- /**
- * Returns the first LayoutObject of a layouted item.
- *
- * @param item
- * @return the LO, or NULL if the item is not layouted
- */
- LayoutObject getFirstLayoutObjectOfItem(Item item)
- {
- if(item != null)
- {
- return getNextLayoutObjectOfItem(null, item);
- }
- return null;
- }
-
- /**
- * Returns the last LayoutObject of a layouted item.
- *
- * @param item
- * @return the LO, or NULL if the item is not layouted
- */
- LayoutObject getLastLayoutObjectOfItem(Item item)
- {
- if(item != null)
- {
- return getPrevLayoutObjectOfItem(null, item);
- }
- return null;
- }
-
- /**
- * Update item state in form.
- *
- * @param item
- * @param updateReason
- * @param param additional parameter
- */
- void updateItemState(Item item, int updateReason, Object param)
- {
- Logger.method(this, "updateItemState", item,
- String.valueOf(updateReason), param);
-
- // Clean reason - without resizing flags
- int reason = updateReason & Item.UPDATE_REASON_MASK;
- switch(reason)
- {
- case Item.UPDATE_NONE:
- break;
- case Item.UPDATE_ADDCOMMAND:
- {
- if(isFormCurrent() && param != null)
- {
- LayoutObject lo = getFirstLayoutObjectOfItem(item);
- if(lo != null && param instanceof Command)
- {
- lo.addCommand((Command) param);
- }
- }
- break;
- }
- case Item.UPDATE_REMOVECOMMAND:
- {
- if(isFormCurrent() && param != null)
- {
- LayoutObject lo = getFirstLayoutObjectOfItem(item);
- if(lo != null && param instanceof Command)
- {
- lo.removeCommand((Command) param);
- }
- }
- break;
- }
- default:
- {
- LayoutObject lo = getFirstLayoutObjectOfItem(item);
- if(lo != null)
- {
- getLayouter(item).updateItem(item, lo.getControl(), reason,
- param);
- }
- break;
- }
- }
-
- // Check this always - because this is a flag
- if((updateReason & Item.UPDATE_HEIGHT_CHANGED)
- == Item.UPDATE_HEIGHT_CHANGED)
- {
- resizeItemAndShift(item);
- }
- }
-
- int eswtGetMaxVPosition()
- {
- return formComposite.getSize().y - getFormHeight();
- }
-
- /**
- * Called by key Form to compute new vertical coordinate to position form's
- * content.
- *
- * @param swtDir scrolling direction.
- * @return New vertical position of Form's content.
- */
- protected int getNextScrollingPosition(int swtDir)
- {
- boolean scrollDown = (swtDir == SWT.ARROW_DOWN
- || swtDir == SWT.ARROW_RIGHT);
- int formHeight = getFormHeight();
- int refPoint;
- int ret = vPosition;
- if(scrollDown)
- {
- ret += formHeight / 5;
- refPoint = (vPosition + 1) + formHeight;
- }
- else
- {
- ret -= formHeight / 5;
- refPoint = (vPosition - 1);
- }
-
- Row row = null;
- for(int i = 0; i < getRowCount(); i++)
- {
- row = getRow(i);
- if(row.isInsideRow(refPoint)
- && (row.getRowHeight() < formHeight))
- {
- if(scrollDown)
- {
- ret = row.getBottomPosition() - formHeight;
- }
- else
- {
- ret = row.getYShift();
- }
- break;
- }
- }
-
- return ret;
- }
-
- /**
- * Set the scrolling to the specified position.<br>
- * This method also updates the Form's scrollbars.
- *
- * @param position new position
- */
- void eswtSetScrollingPosition(int position, boolean keyNav)
- {
- // check constraints
- int newVPosition = position;
- int maxVPos = eswtGetMaxVPosition();
- newVPosition = Math.min(newVPosition, maxVPos);
- newVPosition = Math.max(newVPosition, 0);
-
- vPosition = newVPosition;
- formComposite.setRedraw(false);
- formComposite.setOrigin(0, vPosition, keyNav);
- formComposite.pack();
- formComposite.setRedraw(true);
-
- eswtHandleVisibilityChanges();
- }
-
- /**
- * Returns the scrolling position.
- */
- protected int getScrollingPosition()
- {
- return vPosition;
- }
-
- /**
- * Updates visibility status of all items.
- */
- protected void eswtHandleVisibilityChanges()
- {
- // Logger.method(this, "eswtHandleVisibilityChanges");
- boolean shown = false;
- Item item = null;
- LayoutObject lo = null;
- // Go through all LayoutObjects and check/update visibilities
- while((lo = getNextLayoutObjectOfItem(lo, null)) != null)
- {
- // check if owning item is changing
- if(lo.getOwningItem() != item)
- {
- if(item != null)
- {
- // set current item's visibility
- getLayouter(item).eswtHandleVisibilityChange(item, shown);
- }
- // new item
- item = lo.getOwningItem();
- shown = false;
- }
-
- // track current item's visibility
- if(!shown && isFormCurrent() && isPartiallyVisible(lo))
- {
- shown = true;
- }
- }
-
- // call it for last item
- if(item != null)
- {
- getLayouter(item).eswtHandleVisibilityChange(item, shown);
- }
- }
-
- /**
- * Changes item size and does shift of all Rows.
- *
- * @param item - item to changeSize.
- */
- void resizeItemAndShift(final Item item)
- {
- ESWTUIThreadRunner.syncExec(new Runnable()
- {
- public void run()
- {
- int newVPosition = eswtResizeItemAndShift(item);
- if(newVPosition != vPosition)
- {
- eswtSetScrollingPosition(newVPosition, true);
- }
- else
- {
- eswtHandleVisibilityChanges();
- }
- }
- });
- }
-
- /**
- * eSWT callback for resizeItemAndShift.
- *
- * @param item Item to be resized.
- * @return new scrolling vPosition
- */
- int eswtResizeItemAndShift(Item item)
- {
- Row row = getLastRowOfItem(item);
- int deltaYShift = row.getRowHeight();
- // if we un-comment this then when we set true,
- // focus will jump to first item.
- // eswtUpdateFormComposite(false);
- LayoutObject lo = getFirstLayoutObjectOfItem(item);
- if(lo != null)
- {
- getLayouter(item).eswtResizeObject(lo);
- }
-
- eswtUpdateRow(row);
-
- /*
- // to avoid double call of updateRowInternals
- if (row.getNumLayoutObjects(Item.LAYOUT_SHRINK) > 0
- || row.getNumLayoutObjects(Item.LAYOUT_EXPAND) > 0) {
- eswtUpdateRow(row);
- }
- else {
- row.updateRowInternals();
- }
- */
- deltaYShift = row.getRowHeight() - deltaYShift;
- // row's height change - all remaining rows are shifted with this.
-
- Row lastRow = getLastRow();
- if(row != lastRow)
- {
- for(int i = rows.indexOf(row) + 1; i < getRowCount(); i++)
- {
- row = getRow(i);
- row.setYShift(row.getYShift() + deltaYShift);
- eswtUpdateRow(row);
- }
- }
-
- // following code updates scrolling if needed.
- // need to check where in the form resize happeneed.
-
- int itemRowYShift = getLastRowOfItem(item).getYShift();
- // vPosition should be changed in syncexec
- int newVPosition = vPosition;
-
- // we need to scroll only if changes happened above the screen.
- if(newVPosition >= itemRowYShift)
- {
- newVPosition = Math.max(0, newVPosition + deltaYShift);
- }
- // check to avoid gap in the bottom of the form
- if(newVPosition + getFormHeight() > lastRow.getBottomPosition())
- {
- newVPosition = Math.max(0,
- lastRow.getBottomPosition() - getFormHeight());
- }
-
- eswtUpdateFormComposite(true);
-
- // formComposite.pack();
- // formComposite.updateScrollbarSize(lastRow.getBottomPosition());
-
- return newVPosition;
- }
-
- /**
- * Gets layouter that can layout the specified item.
- *
- * @param item Item to be layouted.
- * @return ItemLayouter or null if no Layouter found.
- */
- protected final ItemLayouter getLayouter(Item item)
- {
- if(item instanceof StringItem)
- {
- return sIL;
- }
- else if(item instanceof ImageItem)
- {
- return imIL;
- }
- else if(item instanceof Gauge)
- {
- return gL;
- }
- else if(item instanceof TextField)
- {
- return tfL;
- }
- else if(item instanceof DateField)
- {
- return dfL;
- }
- else if(item instanceof ChoiceGroup)
- {
- return cgL;
- }
- else if(item instanceof CustomItem)
- {
- return ciL;
- }
- else if(item instanceof Spacer)
- {
- return sL;
- }
- return null;
- }
-
- /**
- * Returns eSWT Control that represents the item specified.
- */
- Control getItemControl(final Item item)
- {
- final LayoutObject lo = getFirstLayoutObjectOfItem(item);
- if(lo != null)
- {
- ESWTUIThreadRunner.syncExec(new Runnable()
- {
- public void run()
- {
- itemMainControl = getLayouter(item)
- .eswtFindSpecificControl(item, lo.getControl());
- }
- });
- return itemMainControl;
- }
- return null;
- }
-
- void updateScrolling(final int value, final boolean keyNav)
- {
- Logger.method("updateScrolling", String.valueOf(value));
- ESWTUIThreadRunner.syncExec(new Runnable()
- {
- public void run()
- {
-
- eswtSetScrollingPosition(value, keyNav);
-
- }
- });
- }
-
- /**
- * Get current scrolling value.
- *
- * @return vPosition.
- */
- int getVPosition()
- {
- return vPosition;
- }
-
-}
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/Displayable.java Fri Jul 23 12:27:20 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/Displayable.java Thu Aug 05 16:07:57 2010 +0300
@@ -28,7 +28,6 @@
import org.eclipse.swt.internal.extension.MobileShellExtension;
import org.eclipse.swt.widgets.*;
import com.nokia.mj.impl.rt.support.ApplicationUtils;
-import com.nokia.mj.impl.rt.support.ApplicationInfo;
/**
* Implementation of LCDUI <code>Displayable</code> class.
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/Form.java Fri Jul 23 12:27:20 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/Form.java Thu Aug 05 16:07:57 2010 +0300
@@ -34,7 +34,7 @@
/**
* Abstract layouting policy.
*/
- private FormLayoutPolicy layoutPolicy;
+ private FormLayouter formLayouter;
/**
* Item vector.
@@ -69,7 +69,7 @@
{
super(title);
construct();
- layoutPolicy = new DefaultFormInteraction(this);
+ formLayouter = new FormLayouter(this);
}
/**
@@ -117,7 +117,7 @@
{
vBar.addSelectionListener(fsbl);
}
- layoutPolicy.handleShowCurrentEvent();
+ formLayouter.handleShowCurrentEvent();
}
/* (non-Javadoc)
@@ -132,7 +132,7 @@
{
vBar.removeSelectionListener(fsbl);
}
- layoutPolicy.handleHideCurrentEvent();
+ formLayouter.handleHideCurrentEvent();
}
/* (non-Javadoc)
@@ -147,7 +147,7 @@
formComposite.setOrigin(0, 0, true);
formComposite.setSize(width, height);
formComposite.setRedraw(true);
- layoutPolicy.handleResizeEvent(width, height);
+ formLayouter.handleResizeEvent(width, height);
resetLayoutTimer(0);
}
}
@@ -166,7 +166,7 @@
}
else
{
- layoutPolicy.handleKeyEvent(e.keyCode, e.type);
+ formLayouter.handleKeyEvent(e.keyCode, e.type);
}
}
@@ -189,7 +189,7 @@
MsgRepository.FORM_EXCEPTION_ITEM_OWNED_BY_CONTAINER);
}
int returnValue = -1;
- synchronized(layoutPolicy)
+ synchronized(formLayouter)
{
item.setParent(this);
items.addElement(item);
@@ -255,7 +255,7 @@
throw new IndexOutOfBoundsException(
MsgRepository.FORM_EXCEPTION_INVALID_ITEM_INDEX);
}
- synchronized(layoutPolicy)
+ synchronized(formLayouter)
{
item.setParent(this);
items.insertElementAt(item, position);
@@ -276,9 +276,11 @@
throw new IndexOutOfBoundsException(
MsgRepository.FORM_EXCEPTION_INVALID_ITEM_INDEX);
}
- synchronized(layoutPolicy)
+ synchronized(formLayouter)
{
- ((Item) items.elementAt(position)).setParent(null);
+ Item item = ((Item) items.elementAt(position));
+ item.clearParent();
+ formLayouter.removeLayoutObject(item);
items.removeElementAt(position);
resetLayoutTimer(position - 1);
}
@@ -289,11 +291,13 @@
*/
public void deleteAll()
{
- synchronized(layoutPolicy)
+ synchronized(formLayouter)
{
for(int i = 0; i < items.size(); i++)
{
- ((Item) items.elementAt(i)).setParent(null);
+ Item item = ((Item) items.elementAt(i));
+ item.clearParent();
+ formLayouter.removeLayoutObject(item);
}
items.removeAllElements();
resetLayoutTimer(0);
@@ -324,11 +328,13 @@
throw new IndexOutOfBoundsException(
MsgRepository.FORM_EXCEPTION_INVALID_ITEM_INDEX);
}
- synchronized(layoutPolicy)
+ synchronized(formLayouter)
{
newItem.setParent(this);
// clear reference to a form for "old" item.
- get(position).setParent(null);
+ Item oldItem = get(position);
+ oldItem.clearParent();
+ formLayouter.removeLayoutObject(oldItem);
items.setElementAt(newItem, position);
resetLayoutTimer(position);
}
@@ -344,7 +350,7 @@
public Item get(int position)
{
Item returnItem = null;
- synchronized(layoutPolicy)
+ synchronized(formLayouter)
{
try
{
@@ -386,7 +392,7 @@
*/
void setCurrentItem(Item item)
{
- layoutPolicy.setCurrentItem(item);
+ formLayouter.setCurrentItem(item);
}
/**
@@ -419,30 +425,24 @@
* @param updateReason
* @param param additional parameter
*/
- void updateItemState(Item item, int updateReason, Object param)
- {
- if(item != null && item.getParent() == this)
- {
- if((updateReason & Item.UPDATE_WIDTH_CHANGED) != 0)
- {
- synchronized(layoutPolicy)
- {
- resetLayoutTimer(items.indexOf(item));
- }
- }
- else
- {
- if(layoutPolicy instanceof DefaultFormInteraction)
- {
- if(layoutTimer != null)
- {
- ((DefaultFormInteraction) layoutPolicy)
- .updateItemState(item, updateReason, param);
- }
- }
- }
- }
- }
+ void updateItemState(Item item, int updateReason, Object param)
+ {
+ if(item != null && item.getParent() == this)
+ {
+ if(layoutTimer != null)
+ {
+ formLayouter.updateItemState(item, updateReason, param);
+ }
+
+ if((updateReason & Item.UPDATE_SIZE_CHANGED) != 0)
+ {
+ synchronized(formLayouter)
+ {
+ resetLayoutTimer(items.indexOf(item));
+ }
+ }
+ }
+ }
/**
* Get Vector of items.
@@ -464,13 +464,13 @@
/**
- * Returns form layout policy.
+ * Returns form Form Layouter.
* @return Reference to layout policy.
*
*/
- FormLayoutPolicy getLayoutPolicy()
+ FormLayouter getFormLayouter()
{
- return layoutPolicy;
+ return formLayouter;
}
// =========================================================================
@@ -483,7 +483,7 @@
super(title);
construct();
layoutLR = leftRightLanguage;
- layoutPolicy = new DefaultFormInteraction(this);
+ formLayouter = new FormLayouter(this);
}
// =========================================================================
@@ -510,13 +510,30 @@
}
// schedule new timer
startIndex = Math.max(0, Math.min(newStartIndex, startIndex));
- // layoutPolicy.layoutForm(startIndex);
+ // formLayouter.layoutForm(startIndex);
formTimerTask = new FormTimerTask(startIndex);
layoutTimer.schedule(formTimerTask, Config.FORM_LAYOUT_TIMER_DELAY);
}
}
/**
+ * Cancel Layout Timer.
+ */
+ private void cancelLayoutTimer()
+ {
+ if(layoutTimer != null)
+ {
+ if(formTimerTask != null)
+ {
+ formTimerTask.cancel();
+ formTimerTask = null;
+ }
+ layoutTimer.cancel();
+ layoutTimer = null;
+ }
+ }
+
+ /**
* Form Timer task. Triggers the formComposite to Layout.
*/
class FormTimerTask extends TimerTask
@@ -532,7 +549,7 @@
public void run()
{
Logger.method(Form.this, "layout");
- layoutPolicy.layoutForm(index);
+ formLayouter.layoutForm(index);
startIndex = items.size();
}
@@ -550,7 +567,7 @@
Point p = ((Control) e.widget).toDisplay(new Point(e.x, e.y));
// translate display coordinates to composite coordinates
p = formComposite.toControl(p);
- layoutPolicy.handlePointerEvent(p.x, p.y, e.type);
+ formLayouter.handlePointerEvent(p.x, p.y, e.type);
}
}
}*/
@@ -568,7 +585,7 @@
public void widgetSelected(SelectionEvent se)
{
ScrollBar sb = (ScrollBar) se.widget;
- layoutPolicy.updateScrolling(sb.getSelection(), false);
+ formLayouter.updateScrolling(sb.getSelection(), false);
}
}
@@ -577,12 +594,12 @@
*/
void dispose()
{
+ cancelLayoutTimer();
super.dispose();
- layoutTimer.cancel();
- layoutTimer = null;
deleteAll();
- ((DefaultFormInteraction) layoutPolicy).dispose();
- layoutPolicy = null;
+ formLayouter.dispose();
+ items = null;
+ formLayouter = null;
}
/*
@@ -593,7 +610,7 @@
if((event.type & LCDUIEvent.CUSTOMITEMBIT) != 0)
{
// Synchronize with Form content modification operations.
- synchronized(layoutPolicy)
+ synchronized(formLayouter)
{
// If the eSWT widget has been explicitly disposed while the event
// was in the queue then ignore the event.
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/FormLayoutPolicy.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-package javax.microedition.lcdui;
-
-abstract class FormLayoutPolicy
-{
-
- /**
- * Layouts the Form.
- *
- * @param startItem item from which to start Layout;
- */
- abstract void layoutForm(int startItem);
-
- /**
- * Set focus to an item.
- */
- abstract void setCurrentItem(Item item);
-
- /**
- * Called when Form becomes current Displayable.
- */
- abstract void handleShowCurrentEvent();
-
- /**
- * Called when Form stops being current Displayable.
- */
- abstract void handleHideCurrentEvent();
-
- /**
- * Called when Form is being resized.
- *
- * @param width new width
- * @param height new height
- */
- abstract void handleResizeEvent(int width, int height);
-
- /**
- * Handle key event.
- *
- * @param keyCode key
- * @param keyType type
- */
- abstract void handleKeyEvent(int keyCode, int keyType);
-
- /**
- * Handle pointer event.
- *
- * @param x coordinate relative to scrolledComposite
- * @param y coordinate relative to scrolledComposite
- * @param type event type: SWT.MouseDown, SWT.MouseMove, SWT.MouseUp
- */
- abstract void handlePointerEvent(int x, int y, int type);
-
- /**
- * Set scrolling of form composite.
- */
- abstract void updateScrolling(int value, boolean keyNavi);
-
- /**
- * Get the layouted conrol of an item.
- *
- * @param item item
- * @return layouted control
- */
- abstract org.eclipse.swt.widgets.Control getItemControl(Item item);
-
- /**
- * Gets layouter that can layout the specified item.
- *
- * @param item Item to be layouted.
- * @return ItemLayouter or null if no Layouter found.
- */
- abstract ItemLayouter getLayouter(Item item);
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/FormLayouter.java Thu Aug 05 16:07:57 2010 +0300
@@ -0,0 +1,2060 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package javax.microedition.lcdui;
+
+import java.util.NoSuchElementException;
+import java.util.Vector;
+import java.util.Enumeration;
+import java.util.Timer;
+import java.util.TimerTask;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+/**
+ * FormLayouter implements form layout algorithm.
+ */
+class FormLayouter
+{
+
+ /**
+ * Form instance (not owned).
+ */
+ private Form form;
+
+ /**
+ * Form's scrolled composite (not owned).
+ */
+ protected ScrolledComposite formComposite;
+
+ /**
+ * Controls vector.
+ */
+ private Vector layoutObjects = new Vector();
+
+ /**
+ * Rows vector.
+ */
+ private Vector rows = new Vector();
+
+ /**
+ * Form's current horizontal alignment
+ */
+ private int currentHLayoutDirective;
+
+ private ImageItemLayouter imIL;
+
+ private StringItemLayouter sIL;
+
+ private GaugeLayouter gL;
+
+ private TextFieldLayouter tfL;
+
+ private DateFieldLayouter dfL;
+
+ private ChoiceGroupLayouter cgL;
+
+ private CustomItemLayouter ciL;
+
+ private SpacerLayouter sL;
+
+ private int vPosition;
+
+ private Item deferredScrollToItem;
+
+ private boolean isCurrent;
+
+ private Control itemMainControl;
+
+ private static final int NO_DIRECTION = -1;
+
+ private Item currentSelectedItem;
+
+ private int direction = NO_DIRECTION;
+
+ private boolean mousePressed;
+
+ private LayoutObject currentlyUnderMouse;
+
+
+ /**
+ * Constructor.
+ *
+ * @param form Form to perform layout on.
+ */
+ FormLayouter(Form form)
+ {
+ this.form = form;
+ formComposite = form.getFormComposite();
+ imIL = new ImageItemLayouter(this);
+ sIL = new StringItemLayouter(this);
+ gL = new GaugeLayouter(this);
+ dfL = new DateFieldLayouter(this);
+ tfL = new TextFieldLayouter(this);
+ cgL = new ChoiceGroupLayouter(this);
+ ciL = new CustomItemLayouter(this);
+ sL = new SpacerLayouter(this);
+ }
+
+ /**
+ * Dispose and cleanup layouted items.
+ */
+ void dispose()
+ {
+ ESWTUIThreadRunner.syncExec(new Runnable()
+ {
+ public void run()
+ {
+ eswtClearRows(0, null);
+ removeAllLayoutObjects();
+ rows = null;
+ layoutObjects = null;
+ }
+ });
+ }
+
+ /**
+ * Log out a control with all its children at the given indentation level.
+ */
+ void logControl(int level, Control control)
+ {
+ if(control != null)
+ {
+ String s2 = control.toString();
+ s2 = s2.substring(0, s2.indexOf('}') - 1);
+ String s3 = control.getBounds().toString();
+ s3 = s3.substring(s3.indexOf('{'));
+ Logger.verbose(Logger.indent(s2 + s3, level * 2));
+ if(control instanceof Composite)
+ {
+ Control[] arr = ((Composite) control).getChildren();
+ for(int i = 0; i < arr.length; i++)
+ {
+ logControl(level + 1, arr[i]);
+ }
+ }
+ }
+ }
+
+ /**
+ * Log out all layoutobjects for each item.
+ */
+ void logFormLayout()
+ {
+ Logger.verbose(form + " ---------------------------------------------");
+ LayoutObject lo = null;
+ Item item = null;
+ int line = -1;
+ while((lo = getNextLayoutObjectOfItem(lo, null)) != null)
+ {
+ if(lo.getOwningItem() != item)
+ {
+ item = lo.getOwningItem();
+ Logger.verbose(item.toString());
+ }
+ if(lo.getRowIdx() != line)
+ {
+ line = lo.getRowIdx();
+ }
+ Logger.verbose(Logger.indent("Row:" + lo.getRowIdx(), 2));
+ logControl(2, lo.getControl());
+ }
+ Logger.verbose(form + " ---------------------------------------------");
+ }
+
+ /**
+ * Called when Form is about to be shown.<br>
+ * NOTE: this is called from eSWT UI-thread
+ */
+ void handleShowCurrentEvent()
+ {
+ Logger.method(this, "handleShowCurrentEvent");
+ isCurrent = true;
+
+ // restore our scrolling position (eSWT resets it to 0 by default)
+ eswtSetScrollingPosition(vPosition, true);
+
+ Item item = null;
+ LayoutObject lo = null;
+ while((lo = getNextLayoutObjectOfItem(lo, null)) != null)
+ {
+ if(lo.getOwningItem() != item)
+ {
+ // item border
+ item = lo.getOwningItem();
+ getItemLayouter(item).eswtAddListeners(item, lo);
+ }
+ }
+
+ eswtApplyCurrentFocus();
+ }
+
+ /**
+ * Called when Form is about to be hidden.<br>
+ * NOTE: this is called from eSWT UI-thread
+ */
+ void handleHideCurrentEvent()
+ {
+ Logger.method(this, "handleHideCurrentEvent");
+ isCurrent = false;
+
+ Item item = null;
+ LayoutObject lo = null;
+ while((lo = getNextLayoutObjectOfItem(lo, null)) != null)
+ {
+ if(lo.getOwningItem() != item)
+ {
+ // item border
+ item = lo.getOwningItem();
+ getItemLayouter(item).eswtRemoveListeners(item, lo);
+ getItemLayouter(item).eswtHandleVisibilityChange(item, false);
+ }
+ }
+
+ direction = NO_DIRECTION;
+ }
+
+ /**
+ * Called when Form is beeing resized.<br>
+ * NOTE: this is called from eSWT UI-thread
+ */
+ void handleResizeEvent(int width, int height)
+ {
+ // Logger.method(this, "handleResizeEvent");
+ int numitems = getItemCount();
+ for(int i = 0; i < numitems; i++)
+ {
+ getItem(i).invalidateCachedSizes();
+ }
+ ItemLayouter.eswtUpdateStaticShellSize(width, height);
+ }
+
+ /**
+ * Do form layout according to startIndex.
+ *
+ * @param startItem - index of item which need to be layouted.
+ */
+ void layoutForm(final int startIndex)
+ {
+ ESWTUIThreadRunner.syncExec(new Runnable()
+ {
+ public void run()
+ {
+ eswtLayoutForm(startIndex);
+ }
+ });
+ }
+
+ /**
+ * eSWT callback for doLayout().
+ */
+ void eswtLayoutForm(int startIndex)
+ {
+ int numItems = getItemCount();
+ Logger.method(this, "eswtLayoutForm", startIndex + " / " + numItems);
+
+ eswtUpdateFormComposite(false);
+ if(numItems > 0)
+ {
+ Item previousItem = null;
+ int startRowIndex = 0;
+
+ if(startIndex > 0)
+ {
+ // Find row with previous item.
+ previousItem = getItem(startIndex - 1);
+ Row prevItemRow = getLastRowOfItem(previousItem);
+ if(prevItemRow != null)
+ {
+ startRowIndex = rows.indexOf(prevItemRow);
+ }
+ }
+
+ // Clear rows starting from item - partial re-layouting
+ eswtClearRows(startRowIndex, previousItem);
+ // Layout items
+ for(int i = startIndex; i < numItems; i++)
+ {
+ eswtLayoutItem(getItem(i));
+ }
+ // Update last row
+ eswtUpdateRow(getLastRow());
+ }
+ else
+ {
+ eswtClearRows(0, null);
+ }
+ // check if we need to scroll to a particular item
+ if(deferredScrollToItem != null)
+ {
+ eswtSetCurrentItem(deferredScrollToItem);
+ deferredScrollToItem = null;
+ }
+ eswtUpdateFormComposite(true);
+ eswtHandleVisibilityChanges();
+
+ if(Logger.isLogVerbose())
+ {
+ logFormLayout();
+ }
+
+ // clear invalid selected item
+ eswtCheckCurrentSelectedItem();
+
+ if(currentSelectedItem != null
+ && (currentSelectedItem.isFocusable()))
+ {
+ eswtApplyCurrentFocus();
+ }
+ else
+ {
+ // If there's no item currently selected try to find first
+ // focusable item and set it current (if found):
+ Item found = eswtGetNextFocusableItem(
+ getItem(startIndex - 1), SWT.ARROW_RIGHT);
+ if(found != null)
+ {
+ eswtSetCurrentSelectedItem(found, NO_DIRECTION);
+ }
+ else
+ {
+ eswtApplyCurrentFocus();
+ }
+ }
+ }
+
+ /**
+ * Returns if the parameter is a eSWT directional key code.
+ *
+ * @param keyCode key code
+ */
+ private boolean isDirectionKey(int keyCode)
+ {
+ return (keyCode == SWT.ARROW_DOWN || keyCode == SWT.ARROW_UP
+ || keyCode == SWT.ARROW_LEFT || keyCode == SWT.ARROW_RIGHT);
+ }
+
+ /**
+ * Handler for key events.<br>
+ * The implementation moves focus and/or scrolls the form when
+ * needed. The method is called by the Form.
+ *
+ * @param keyCode eSWT key code.
+ * @param keyType eSWT key type.
+ */
+ final void handleKeyEvent(int keyCode, int keyType)
+ {
+ Logger.method(this, "handleKeyEvent", currentSelectedItem,
+ String.valueOf(keyCode), String.valueOf(keyType));
+
+ boolean isDirectionalKey = isDirectionKey(keyCode);
+ if(keyType == SWT.KeyDown && isDirectionalKey)
+ {
+ eswtCheckCurrentSelectedItem();
+ }
+
+ if(currentSelectedItem != null)
+ {
+ if(getItemLayouter(currentSelectedItem).eswtOfferKeyEvent(
+ currentSelectedItem, keyCode, keyType))
+ {
+ // if the key has been consumed
+ return;
+ }
+ }
+
+ // scrolling/focus traverse only happens on directional key's down event
+ if(keyType == SWT.KeyDown && isDirectionalKey)
+ {
+ // try to find next focusable item
+ Item next = eswtGetNextFocusableItem(currentSelectedItem, keyCode);
+
+ // if no visible & focusable item was found to transfer focus
+ if(next == currentSelectedItem)
+ {
+ // try to scroll a bit
+ eswtSetScrollingPosition(getNextScrollingPosition(keyCode),
+ true);
+ // find next focusable after scrolling
+ next = eswtGetNextFocusableItem(currentSelectedItem, keyCode);
+ }
+
+ if(next != currentSelectedItem)
+ {
+ //textfield always have to be fully visible when focused.
+ if(next instanceof TextField)
+ {
+ eswtScrollToItem(next);
+ }
+ eswtSetCurrentSelectedItem(next, keyCode);
+ }
+ }
+ }
+
+ /**
+ * Handler for pointer events.<br>
+ * The method is called by the Form.
+ *
+ * @param x coordinate relative to scrolledComposite
+ * @param y coordinate relative to scrolledComposite
+ * @param type event type: SWT.MouseDown, SWT.MouseMove, SWT.MouseUp
+ */
+ final void handlePointerEvent(int x, int y, int type)
+ {
+ Logger.method(this, "handlePointerEvent", String.valueOf(x),
+ String.valueOf(y), String.valueOf(type));
+
+ // TODO: change when DirectUI style arrives.
+ /*
+ Item item;
+ if (type == SWT.MouseMove) {
+ if (currentlyUnderMouse == null
+ || !currentlyUnderMouse.contains(x, y)) {
+ if (currentlyUnderMouse != null) {
+ //currentlyUnderMouse.getControl().setCapture(false);
+ }
+ item = eswtFindItemUnderMouse(x, y);
+ if (item != null && item != currentSelectedItem
+ && item.isFocusable()) {
+ setCurrentItem(item);
+ item.internalSetFocused(true);
+ eswtSetCurrentSelectedItem(item);
+ //following method causes all mouse events delivered to it
+
+ currentlyUnderMouse.getControl().setCapture(true);
+ Logger.warning("seting capture to:" + item);
+ }
+ }
+ int currentVPosition = getVPosition();
+ boolean isMouseDirectionUp = false;
+ boolean doScrolling = false;
+ int localY = y;
+
+ if (y <= currentVPosition) {
+ localY = Math.max(0, y);
+ eswtSetScrollingPosition(localY, true);
+ isMouseDirectionUp = true;
+ doScrolling = true;
+ }
+ else if (y > (currentVPosition + getFormHeight())) {
+ //check for maxVPosition
+ if (y > (eswtGetMaxVPosition() + getFormHeight())) {
+ localY = eswtGetMaxVPosition() + getFormHeight();
+ }
+ else {
+ localY = y;
+ }
+ currentVPosition = localY - getFormHeight();
+ eswtSetScrollingPosition(currentVPosition, true);
+
+ isMouseDirectionUp = false;
+ doScrolling = true;
+ }
+ if (mousePressed && doScrolling) {
+ resetEventTimer(isMouseDirectionUp, localY);
+ }
+ }
+ else
+ if (type == SWT.MouseDown) {
+ mousePressed = true;
+ item = eswtFindItemUnderMouse(x, y);
+ if (item != null && item != currentSelectedItem
+ && item.isFocusable() && getForm().getShell() ==
+ getForm().getShell().getDisplay().getActiveShell()) {
+ //eswtScrollToItem(item);
+ //following method causes all mouse events delivered to it
+
+ //currentlyUnderMouse.getControl().setCapture(true);
+ }
+ }
+ else if (type == SWT.MouseUp) {
+ mousePressed = false;
+ if (currentlyUnderMouse != null) {
+ //currentlyUnderMouse.getControl().setCapture(false);
+ }
+ }*/
+ }
+
+ /**
+ * Find item at the specified point.
+ *
+ * @param x coordinate.
+ * @param y coordinate.
+ * @return Item.
+ */
+ Item eswtFindItemUnderMouse(int x, int y)
+ {
+ Row itemRow;
+ for(int i = 0; i < getRowCount(); i++)
+ {
+ itemRow = getRow(i);
+ if(itemRow.getYShift() <= y && y <= itemRow.getBottomPosition())
+ {
+ LayoutObject lo;
+ for(int j = 0; j < itemRow.size(); j++)
+ {
+ lo = itemRow.getLayoutObject(j);
+ if(lo.contains(x, y))
+ {
+ Logger.info("Item under mouse: "
+ + lo.getOwningItem());
+ currentlyUnderMouse = lo;
+ return lo.getOwningItem();
+ }
+ }
+ break;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Gets next (or nearest) focusable item.
+ *
+ * @param fromItem Item where to start to search the next focusable item.
+ * @param dir Search direction, one of the arrow key constants defined
+ * in class SWT.
+ *
+ * @return Nearest focusable item or null if no item found.
+ */
+ final Item eswtGetNextFocusableItem(Item fromItem, int dir)
+ {
+ Item nextItem = fromItem;
+
+ switch(dir)
+ {
+ case SWT.ARROW_RIGHT:
+ {
+ LayoutObject obj = getLastLayoutObjectOfItem(fromItem);
+ while((obj = getNextLayoutObjectOfItem(obj, null)) != null)
+ {
+ Item owner = obj.getOwningItem();
+ if(owner != null && owner != fromItem
+ && owner.isFocusable()
+ && isPartiallyVisible(obj, Config.DFI_VISIBILITY_PERCENT))
+ {
+ nextItem = owner;
+ break;
+ }
+ }
+ break;
+ }
+
+ case SWT.ARROW_LEFT:
+ {
+ LayoutObject obj = getFirstLayoutObjectOfItem(fromItem);
+ while((obj = getPrevLayoutObjectOfItem(obj, null)) != null)
+ {
+ Item owner = obj.getOwningItem();
+ if(owner != null && owner != fromItem
+ && owner.isFocusable()
+ && isPartiallyVisible(obj, Config.DFI_VISIBILITY_PERCENT))
+ {
+ nextItem = owner;
+ break;
+ }
+ }
+ break;
+ }
+
+ case SWT.ARROW_DOWN:
+ {
+ int minDist = Integer.MAX_VALUE;
+ LayoutObject start = getLastLayoutObjectOfItem(fromItem);
+ LayoutObject obj = start;
+ while((obj = getNextLayoutObjectOfItem(obj, null)) != null)
+ {
+ Item owner = obj.getOwningItem();
+ if(owner != null && owner != fromItem
+ && owner.isFocusable() && obj.isBelow(start)
+ && isPartiallyVisible(obj, Config.DFI_VISIBILITY_PERCENT))
+ {
+ int dist = obj.distanceTo(start);
+ if(dist < minDist)
+ {
+ minDist = dist;
+ nextItem = owner;
+ }
+ }
+ }
+ break;
+ }
+
+ case SWT.ARROW_UP:
+ {
+ int minDist = Integer.MAX_VALUE;
+ LayoutObject start = getFirstLayoutObjectOfItem(fromItem);
+ LayoutObject obj = start;
+ while((obj = getPrevLayoutObjectOfItem(obj, null)) != null)
+ {
+ Item owner = obj.getOwningItem();
+ if(owner != null && owner != fromItem
+ && owner.isFocusable() && obj.isAbove(start)
+ && isPartiallyVisible(obj, Config.DFI_VISIBILITY_PERCENT))
+ {
+ int dist = obj.distanceTo(start);
+ if(dist < minDist)
+ {
+ minDist = dist;
+ nextItem = owner;
+ }
+ }
+ }
+ break;
+ }
+
+ default:
+ }
+
+ return nextItem;
+ }
+
+ /**
+ * Check if the currentSelectedItem is valid and visible. If not then it
+ * sets it to null.
+ */
+ final void eswtCheckCurrentSelectedItem()
+ {
+ if(currentSelectedItem != null)
+ {
+ if(currentSelectedItem.getParent() != getForm()
+ || !currentSelectedItem.isVisible())
+ {
+ // we need to find another
+ Logger.method(this, "eswtCheckCurrentSelectedItem");
+ eswtSetCurrentSelectedItem(null, NO_DIRECTION);
+ }
+ }
+ }
+
+ /**
+ * Sets currentSelectedItem and sets focus to it.<br>
+ * If one of form's items is already selected when this method is called,
+ * removes focus from old item and then moves focus to new one.
+ *
+ * @param item Item to set as current selected. If null, nothing happens.
+ * @param dir Direction which is delivered to layouter.
+ */
+ void eswtSetCurrentSelectedItem(Item item, int dir)
+ {
+ if(currentSelectedItem != item)
+ {
+ Logger.info(this + "::SelectedItem: "
+ + currentSelectedItem + " --(" + dir + ")--> " + item);
+
+ // Save direction
+ direction = dir;
+ // Remove focus from currentSelectedItem and notify its Layouter.
+ if(currentSelectedItem != null)
+ {
+ getItemLayouter(currentSelectedItem).eswtFocusLost(
+ currentSelectedItem);
+ }
+
+ // Set new currentSelectedItem, must be focusable or null
+ currentSelectedItem = item;
+
+ // Set focus to currentSelectedItem and notify its Layouter.
+ if(currentSelectedItem != null)
+ {
+ getItemLayouter(currentSelectedItem).eswtFocusGained(
+ currentSelectedItem, dir);
+ }
+
+ // Apply eSWT focus to currentSelectedItem's control
+ eswtApplyCurrentFocus();
+ }
+ }
+
+ /**
+ * Sets currentSelectedItem and sets focus to it.<br>
+ * If one of form's items is already selected when this method is called,
+ * removes focus from old item and then moves focus to new one.
+ *
+ * @param item Item to set as current selected. If null, nothing happens.
+ * @param dir Direction which is delivered to layouter.
+ */
+ void eswtSetCurrentSelectedItem(Item item)
+ {
+ if(currentSelectedItem != item)
+ {
+ Logger.info(this + "::SelectedItem: "
+ + currentSelectedItem + " ---> " + item);
+
+ // Remove focus from currentSelectedItem and notify its Layouter.
+ if(currentSelectedItem != null)
+ {
+ getItemLayouter(currentSelectedItem).eswtFocusLost(
+ currentSelectedItem);
+ }
+
+ // Set new currentSelectedItem, must be focusable or null
+ currentSelectedItem = item;
+
+ // Set focus to currentSelectedItem and notify its Layouter.
+ if(currentSelectedItem != null)
+ {
+ getItemLayouter(currentSelectedItem).eswtFocusGained(
+ currentSelectedItem, NO_DIRECTION);
+ }
+
+ // Apply eSWT focus to currentSelectedItem's control
+ //eswtApplyCurrentFocus();
+ }
+ }
+
+ /**
+ * Sets focus to currentSelectedItem's control if its partially visible.
+ * Otherwise it sets dummy focus to form's composite.<br>
+ * <br>
+ * Note that this method applies focus only to eSWT control. Item focus
+ * update and layouter notifications are handled in method
+ * <code>eswtSetCurrentSelectedItem()</code>.<br>
+ * If currentSelectedItem is null or form is not shown, this method has no
+ * effect.
+ */
+ void eswtApplyCurrentFocus()
+ {
+ if(isFormCurrent())
+ {
+ // if any of the Item's LayoutObjects is visible
+ if(isItemPartiallyVisible(currentSelectedItem))
+ {
+ Logger.method(this, "ApplyFocus", currentSelectedItem);
+ eswtSetFocusToFirstControl(currentSelectedItem);
+ }
+ else
+ {
+ Logger.method(this, "ApplyFocus", "dummy");
+ formComposite.forceFocus();
+ }
+ }
+ }
+
+ /**
+ * If the Item is valid and it is layouted, then sets the Item's first
+ * LayoutObject focused.
+ *
+ * @param item an item which first LayoutObject is set focused.
+ */
+ void eswtSetFocusToFirstControl(Item item)
+ {
+ if(item != null && item.isFocusable())
+ {
+ LayoutObject lo = getFirstLayoutObjectOfItem(item);
+ if(lo != null)
+ {
+ lo.getControl().forceFocus();
+ }
+ }
+ }
+
+ /**
+ * Gets Current selected item.
+ *
+ * @return Current selected item. May also return null.
+ */
+ Item getCurrentSelectedItem()
+ {
+ return currentSelectedItem;
+ }
+
+ /**
+ * Get the direction of scrolling.
+ *
+ * @return direction of scrolling.
+ */
+ int getDirection()
+ {
+ return direction;
+ }
+
+ /**
+ * Set focus to an item if it is focusable and scroll form to make it
+ * visible if it is not.
+ *
+ * @param item Item to set as current item.
+ */
+ void setCurrentItem(final Item item)
+ {
+ Logger.method(this, "setCurrentItem", item);
+ ESWTUIThreadRunner.syncExec(new Runnable()
+ {
+ public void run()
+ {
+ eswtSetCurrentItem(item);
+ }
+ });
+ }
+
+ /**
+ * eSWT callback for setCurrentItem.
+ */
+ boolean eswtSetCurrentItem(Item item)
+ {
+ if(item != null)
+ {
+ if(isItemLayouted(item))
+ {
+ eswtScrollToItem(item);
+ deferredScrollToItem = null;
+
+ if(item.isFocusable())
+ {
+ eswtSetCurrentSelectedItem(item, NO_DIRECTION);
+ Logger.info("eswtSetCurrentItem" + item);
+ }
+ return true;
+ }
+ else
+ {
+ deferredScrollToItem = item;
+ }
+ }
+ return false;
+ }
+
+ void eswtScrollToItem(Item item)
+ {
+ if(item != null)
+ {
+ int pos = getItemBottomPosition(item) - getFormHeight();
+ if(!isItemPartiallyVisible(item))
+ {
+ eswtSetScrollingPosition(pos, true);
+ }
+ else if(item instanceof TextField && !isItemFullyVisible(item))
+ {
+ eswtSetScrollingPosition(pos, true);
+ }
+ }
+ }
+
+ void eswtScrolltoRegion(int yTop, int yBottom, int swtDir)
+ {
+ if(yTop < vPosition || yBottom > vPosition + getFormHeight())
+ {
+ // if the region is somewhat outside the screen
+ if(swtDir == SWT.ARROW_DOWN || swtDir == SWT.ARROW_RIGHT)
+ {
+ // align to top
+ eswtSetScrollingPosition(yTop, true);
+ }
+ else
+ {
+ // align to bottom
+ eswtSetScrollingPosition(yBottom - getFormHeight(), true);
+ }
+ }
+ }
+
+ void eswtScrollIfNeeded(final int top, final int bottom)
+ {
+ if(bottom > vPosition + getFormHeight())
+ {
+ eswtSetScrollingPosition(bottom - (getFormHeight() / 2), true);
+ }
+ else if(top < vPosition)
+ {
+ eswtSetScrollingPosition(bottom - (getFormHeight() / 2), true);
+ }
+ }
+
+ /**
+ * Get control's position relative to composite.
+ */
+ void getControlPositionOnComposite(Control control, Point location)
+ {
+ if(control != formComposite)
+ {
+ Point rel = control.getLocation();
+ location.x += rel.x;
+ location.y += rel.y;
+ getControlPositionOnComposite(control.getParent(), location);
+ }
+ }
+
+ /**
+ * eSWT specific calls to do update ScrolledComposite.
+ */
+ private void eswtUpdateFormComposite(boolean show)
+ {
+ if(getRowCount() > 0)
+ {
+ if(show)
+ {
+ formComposite.updateScrollbar(getLastRow().getBottomPosition());
+ formComposite.pack();
+ }
+ }
+ // Could happen if changing item from very tall to very short.
+ // so we have to update VPosition
+ if(getVPosition() > eswtGetMaxVPosition())
+ {
+ eswtSetScrollingPosition(eswtGetMaxVPosition(), false);
+ }
+
+ formComposite.setRedraw(show);
+ formComposite.setVisible(show);
+ }
+
+ /**
+ * Clean all form rows starting from startIndex.
+ *
+ * @param startIndex Start row from which to clean.
+ * @param keepItem - item in a startRow which shouldn't be recreated.
+ */
+ private void eswtClearRows(int startIndex, Item keepItem)
+ {
+ Logger.method(this, "clearRows", String.valueOf(startIndex), keepItem);
+ Row row = null;
+ for(int i = (getRowCount() - 1); i >= startIndex; i--)
+ {
+ row = getRow(i);
+ if(row.cleanRow(keepItem))
+ {
+ break;
+ }
+ else
+ {
+ rows.removeElement(row);
+ }
+ }
+
+ // one row always should be available.
+ if((getRowCount() == 0))
+ {
+ // rows.addElement(tempRow);
+ currentHLayoutDirective = Item.LAYOUT_DEFAULT;
+ Row newRow = new Row(ItemLayouter.getMaximumItemWidth(null),
+ getCurrentHLayoutDirective());
+ rows.addElement(newRow);
+ }
+ }
+
+ /**
+ * Update Row's internal layout. Handles LAYOUT_2 related post-processing.
+ *
+ * @param row Row
+ */
+ private void eswtUpdateRow(Row row)
+ {
+ if(row != null)
+ {
+ //Logger.verbose("updateRow start: " + row);
+ int numShrink = row.getNumLayoutObjects(Item.LAYOUT_SHRINK);
+ int numExpand = row.getNumLayoutObjects(Item.LAYOUT_EXPAND);
+ //Logger.verbose("shrink: " + numShrink + " expand: " + numExpand);
+
+ int vMask = Item.LAYOUT_VSHRINK | Item.LAYOUT_VEXPAND;
+ // Expand items vertically with VSHRINK or VEXPAND layout directive
+ LayoutObject lo = null;
+ int maxHeight = row.getRowHeight(vMask);
+ while((lo = row.getNextLayoutObject(lo, vMask)) != null)
+ {
+ if(lo.getOwningItem().hasLayout(Item.LAYOUT_VSHRINK))
+ {
+ int pref = lo.getOwningItem().getPreferredHeight();
+ getItemLayouter(lo.getOwningItem()).eswtResizeObject(lo,
+ lo.getWidth(), Math.min(pref, maxHeight));
+ }
+ else if(lo.getOwningItem().hasLayout(Item.LAYOUT_VEXPAND))
+ {
+ getItemLayouter(lo.getOwningItem()).eswtResizeObject(lo,
+ lo.getWidth(), maxHeight);
+ }
+ }
+
+ // Expand items with SHRINK layout directive
+ if(numShrink > 0)
+ {
+ // Get extra space before shrink and expand
+ int offset = row.getFreeSpace() / numShrink;
+ // Logger.verbose("shrinkOffset: " + offset);
+ if(offset >= 0)
+ {
+ while((lo = row.getNextLayoutObject(lo, Item.LAYOUT_SHRINK)) != null)
+ {
+ int pref = lo.getOwningItem().getPreferredWidth();
+ int min = lo.getOwningItem().getMinimumWidth();
+ int itemWidth = Math.min(pref, min + offset);
+ getItemLayouter(lo.getOwningItem()).eswtResizeObject(lo,
+ itemWidth, lo.getHeight());
+ }
+ }
+ }
+
+ // Expand items with EXPAND layout directive
+ if(numExpand > 0)
+ {
+ // Get extra space after shrink but before expand
+ int offset = row.getFreeSpace(Item.LAYOUT_EXPAND) / numExpand;
+ if(offset >= 0)
+ {
+ // Logger.verbose("expandOffset: " + offset);
+ while((lo = row.getNextLayoutObject(lo, Item.LAYOUT_EXPAND)) != null)
+ {
+ int pref = lo.getOwningItem().getPreferredWidth();
+ getItemLayouter(lo.getOwningItem()).eswtResizeObject(lo,
+ pref + offset, lo.getHeight());
+ }
+ }
+ }
+
+ //if (numShrink > 0 || numExpand > 0) {
+ row.updateRowInternals();
+ //}
+
+ row.updateRowLayout(form.getLeftRightLanguage());
+ // Logger.verbose("updateRow: " + row);
+ }
+ }
+
+ /**
+ * Add a new Row.
+ */
+ private Row eswtAddNewRow()
+ {
+ Row lastRow = getLastRow();
+ eswtUpdateRow(lastRow);
+ int yShift = (lastRow == null ? 0 : lastRow.getBottomPosition());
+ // create new Row
+ Row newRow = new Row(ItemLayouter.getMaximumItemWidth(null),
+ getCurrentHLayoutDirective());
+ newRow.setYShift(yShift);
+ rows.addElement(newRow);
+ return newRow;
+ }
+
+ /**
+ * Add a LayoutObject to the last Row.
+ *
+ * @param layoutObject the layout object
+ */
+ void eswtAddNewLayoutObject(LayoutObject layoutObject)
+ {
+ if(!layoutObjects.contains(layoutObject))
+ {
+ layoutObjects.addElement(layoutObject);
+ }
+ Row lastRow = getLastRow();
+ // check if the current Row is full
+ if(!lastRow.isEmpty()
+ && lastRow.getFreeSpace() < layoutObject.getWidth())
+ {
+ lastRow = eswtAddNewRow();
+ }
+ lastRow.eswtAddLayoutObject(layoutObject);
+ layoutObject.setRowIdx(getRowCount() - 1);
+ }
+
+ /**
+ * Optionally add a new Row and adds a LayoutObject.
+ *
+ * @param layoutObject the layout object
+ * @param newRow adds a new row if true. If false, adds new row only if
+ * there's no space for layoutObject in current row.
+ */
+ void eswtAddNewLayoutObject(LayoutObject layoutObject, boolean newRow)
+ {
+ if(newRow)
+ {
+ eswtAddNewRow();
+ }
+ eswtAddNewLayoutObject(layoutObject);
+ }
+
+ /**
+ * Layout item in a row, if needed new row is added.
+ *
+ * @param row - where to startLayout.
+ * @param item - Item to Layout
+ */
+ private void eswtLayoutItem(Item item)
+ {
+ Row lastRow = getLastRow();
+ boolean hlChange = setCurrentHLayoutDirective(item.internalGetLayout());
+ if(hlChange || getItemNewLineBefore(item))
+ {
+ // newline directive or horizontal layout changed
+ if(lastRow.isEmpty())
+ {
+ // if the current/last row is empty - use that
+ lastRow.setRowHLayout(getCurrentHLayoutDirective());
+ }
+ else
+ {
+ eswtAddNewRow();
+ }
+ }
+
+ // Use the specific layouter to layout item in the last row
+ getItemLayouter(item).eswtLayoutItem(getLastRow(), item);
+
+ if(form.eswtIsShown())
+ {
+ LayoutObject lo = getFirstLayoutObjectOfItem(item);
+ if(lo != null)
+ {
+ getItemLayouter(item).eswtAddListeners(item, lo);
+ }
+ }
+
+ if(getItemNewLineAfter(item))
+ {
+ eswtAddNewRow();
+ }
+ }
+
+ /**
+ * Set Form's Layout directive. if it differ from current set flag
+ * startFromNewLine = true;
+ *
+ * @param newLayoutDirective
+ * @return true if a layout change has occured
+ */
+ private boolean setCurrentHLayoutDirective(int newLayoutDirective)
+ {
+ int newHLayoutDirective = Item.getHorizontalLayout(newLayoutDirective);
+ if((newHLayoutDirective != currentHLayoutDirective)
+ && (newHLayoutDirective != Item.LAYOUT_DEFAULT))
+ {
+ currentHLayoutDirective = newHLayoutDirective;
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Get Form current Layout directive.
+ *
+ * @return current Layout directive for Form.
+ */
+ private int getCurrentHLayoutDirective()
+ {
+ if(currentHLayoutDirective == Item.LAYOUT_DEFAULT)
+ {
+ return getLanguageSpecificLayoutDirective();
+ }
+ return currentHLayoutDirective;
+ }
+
+ /**
+ * Returns language specific layout directive.
+ *
+ * @return LAYOUT_LEFT or LAYOUT_RIGHT.
+ */
+ int getLanguageSpecificLayoutDirective()
+ {
+ if(form.getLeftRightLanguage())
+ {
+ return Item.LAYOUT_LEFT;
+ }
+ else
+ {
+ return Item.LAYOUT_RIGHT;
+ }
+ }
+
+ private boolean getItemNewLineBefore(Item item)
+ {
+ return ((item.internalGetLayout() & Item.LAYOUT_NEWLINE_BEFORE) != 0);
+ }
+
+ private boolean getItemNewLineAfter(Item item)
+ {
+ return ((item.internalGetLayout() & Item.LAYOUT_NEWLINE_AFTER) != 0);
+ }
+
+ boolean isItemLayouted(Item item)
+ {
+ return (getFirstLayoutObjectOfItem(item) != null);
+ }
+
+ /**
+ * Returns if the form is shown.
+ */
+ boolean isFormCurrent()
+ {
+ return isCurrent;
+ }
+
+ /**
+ * Returns if the region is partially visible.
+ *
+ * @param viewTop viewPort's top position
+ * @param viewBottom viewPort's bottom position
+ * @return true if visible
+ */
+ boolean isPartiallyVisible(int yTop, int yBottom)
+ {
+ int vBottomPosition = vPosition + getFormHeight();
+ if((vPosition <= yTop && vBottomPosition <= yTop)
+ || (vPosition >= yBottom && vBottomPosition >= yBottom))
+ {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Returns if at least the region's given percentage is visible.
+ */
+ boolean isPartiallyVisible(int yTop, int yBottom, int minPercent)
+ {
+ int visPercent = getVisibilityPercent(yTop, yBottom);
+ if(visPercent > minPercent)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Returns the region's visibility percentage.
+ */
+ int getVisibilityPercent(int yTop, int yBottom)
+ {
+ if(yTop >= yBottom)
+ {
+ return 0;
+ }
+ int vBottomPosition = vPosition + getFormHeight();
+ int r1 = Math.max(vPosition, Math.min(yTop, vBottomPosition));
+ int r2 = Math.min(vBottomPosition, Math.max(yBottom, vPosition));
+ return ((r2 - r1) * 100) / (yBottom - yTop);
+ }
+
+ /**
+ * Returns if the LayoutObject is partially visible.
+ */
+ boolean isPartiallyVisible(LayoutObject lo)
+ {
+ if(lo != null)
+ {
+ return isPartiallyVisible(lo.getY(), lo.getY() + lo.getHeight());
+ }
+ return false;
+ }
+
+ /**
+ * Returns if at least the LayoutObject's given percentage is visible.
+ */
+ boolean isPartiallyVisible(LayoutObject lo, int minPercent)
+ {
+ if(lo != null)
+ {
+ return isPartiallyVisible(lo.getY(), lo.getY() + lo.getHeight(),
+ minPercent);
+ }
+ return false;
+ }
+
+ /**
+ * Returns if the Item is partially visible (if one of its LayoutObjects is
+ * partially visible).
+ *
+ * @param item the Item
+ * @return true if partially visible
+ */
+ boolean isItemPartiallyVisible(Item item)
+ {
+ if(item != null)
+ {
+ LayoutObject lo = null;
+ while((lo = getNextLayoutObjectOfItem(lo, item)) != null)
+ {
+ if(isPartiallyVisible(lo))
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+
+
+ /**
+ * Returns true if item is fully visible.
+ *
+ * @param item the Item.
+ * @return true if fully visible.
+ */
+ boolean isItemFullyVisible(Item item)
+ {
+ if(item != null)
+ {
+ LayoutObject lo = null;
+ while((lo = getNextLayoutObjectOfItem(lo, item)) != null)
+ {
+ if(!isLOFullyVisible(lo))
+ {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Returns if the LayoutObject is fully visible.
+ */
+ boolean isLOFullyVisible(LayoutObject lo)
+ {
+ if(lo != null)
+ {
+ return isFullyVisible(lo.getY(), lo.getY() + lo.getHeight());
+ }
+ return false;
+ }
+
+ /**
+ * Returns if the region is fully visible.
+ *
+ * @param viewTop viewPort's top position
+ * @param viewBottom viewPort's bottom position
+ * @return true if visible
+ */
+ boolean isFullyVisible(int yTop, int yBottom)
+ {
+ int vBottomPosition = vPosition + getFormHeight();
+ if((vPosition <= yTop && vBottomPosition >= yBottom))
+ {
+ return true;
+ }
+ return false;
+ }
+
+ int getItemTopPosition(Item item)
+ {
+ LayoutObject lo = getFirstLayoutObjectOfItem(item);
+ if(lo != null)
+ {
+ return lo.getY();
+ }
+ return 0;
+ }
+
+ int getItemBottomPosition(Item item)
+ {
+ LayoutObject lo = getLastLayoutObjectOfItem(item);
+ if(lo != null)
+ {
+ return lo.getY() + lo.getHeight();
+ }
+ return 0;
+ }
+
+ int getItemCount()
+ {
+ return form.size();
+ }
+
+ Item getItem(int index)
+ {
+ try
+ {
+ return (Item) form.getItems().elementAt(index);
+ }
+ catch(ArrayIndexOutOfBoundsException e)
+ {
+ // Logger.exception(e);
+ return null;
+ }
+ }
+
+ int getItemIndex(Item item)
+ {
+ return form.getItems().indexOf(item);
+ }
+
+ int getRowCount()
+ {
+ return rows.size();
+ }
+
+ /**
+ * Return the Row with the given index.
+ *
+ * @param index Row's index
+ * @return a Row
+ */
+ Row getRow(int index)
+ {
+ try
+ {
+ return (Row) rows.elementAt(index);
+ }
+ catch(ArrayIndexOutOfBoundsException e)
+ {
+ Logger.exception("getRow", e);
+ return null;
+ }
+ }
+
+ /**
+ * Return the Row to which the given LayoutObject belongs.
+ *
+ * @param lo LayoutObject
+ * @return the owning Row
+ */
+ Row getRow(LayoutObject lo)
+ {
+ try
+ {
+ return getRow(lo.getRowIdx());
+ }
+ catch(NullPointerException e)
+ {
+ // Logger.exception("getRow", e);
+ return null;
+ }
+ }
+
+ /**
+ * Returns the last row of the form.
+ */
+ Row getLastRow()
+ {
+ try
+ {
+ return (Row) rows.lastElement();
+ }
+ catch(NoSuchElementException nse)
+ {
+ // Logger.exception("getLastRow", nse);
+ return null;
+ }
+ }
+
+ /**
+ * Find last row which contains corresponding Item.
+ *
+ * @param item Item in a Row.
+ * @return Last Row with that item.
+ */
+ Row getLastRowOfItem(Item item)
+ {
+ return getRow(getLastLayoutObjectOfItem(item));
+ }
+
+ /**
+ * Get Form which requires layout.
+ *
+ * @return form.
+ */
+ Form getForm()
+ {
+ return form;
+ }
+
+ /**
+ * Form's content height.
+ */
+ int getFormHeight()
+ {
+ return form.getHeight();
+ }
+
+ /**
+ * Form's content width.
+ */
+ int getFormWidth()
+ {
+ return form.getWidth();
+ }
+
+ /**
+ * Returns LayoutObject for the given Item.
+ *
+ * @param item Item to layout
+ * @return LayoutObject
+ */
+ LayoutObject getLayoutObject(Item item)
+ {
+ int num = layoutObjects.size();
+
+ for(int i = 0; i < num; i++)
+ {
+ if(((LayoutObject)layoutObjects.elementAt(i)).getOwningItem() == item)
+ {
+ LayoutObject lo = (LayoutObject)(layoutObjects.elementAt(i));
+ lo.setRowIdx(-1);
+ return lo;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Removes Layout Object for the given Item.
+ *
+ * @param item Item to remove LayoutObject
+ */
+ void removeLayoutObject(Item item)
+ {
+
+ int num = layoutObjects.size();
+
+ for(int i = 0; i < num; i++)
+ {
+ if(((LayoutObject)layoutObjects.elementAt(i)).getOwningItem() == item)
+ {
+ LayoutObject lo = (LayoutObject)(layoutObjects.elementAt(i));
+ layoutObjects.removeElement(lo);
+ lo.dispose();
+ break;
+ }
+ }
+ }
+
+ /**
+ * Removes all Layout Objects from the FormLayouter.
+ */
+ void removeAllLayoutObjects()
+ {
+ Enumeration e = layoutObjects.elements();
+
+ while(e.hasMoreElements())
+ {
+ LayoutObject lo = (LayoutObject)e.nextElement();
+ layoutObjects.removeElement(lo);
+ lo.dispose();
+ }
+ }
+
+ /**
+ * Returns the next LayoutObject belonging to this Item.<br>
+ *
+ * @param lo starting LayoutObject; if null then it start from first.
+ * @param item specifies the parent Item; null means any Item
+ * @return the next LayoutObject in the layout.
+ */
+ LayoutObject getNextLayoutObjectOfItem(LayoutObject lo, Item item)
+ {
+ int startRow = (lo == null ? 0 : lo.getRowIdx());
+ LayoutObject temp = null;
+ for(int i = startRow; i < getRowCount(); i++)
+ {
+ temp = getRow(i).getNextLayoutObject(lo, item);
+ if(temp != null && temp != lo)
+ {
+ return temp;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the previous LayoutObject belonging to this Item.<br>
+ *
+ * @param lo starting LayoutObject; if null then it start from last.
+ * @param item specifies the parent Item; null means any Item
+ * @return the previous LayoutObject in the layout.
+ */
+ LayoutObject getPrevLayoutObjectOfItem(LayoutObject lo, Item item)
+ {
+ int startRow = (lo == null ? rows.size() - 1 : lo.getRowIdx());
+ LayoutObject temp = null;
+ for(int i = startRow; i >= 0; i--)
+ {
+ temp = getRow(i).getPrevLayoutObject(lo, item);
+ if(temp != null && temp != lo)
+ {
+ return temp;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the first LayoutObject of a layouted item.
+ *
+ * @param item
+ * @return the LO, or NULL if the item is not layouted
+ */
+ LayoutObject getFirstLayoutObjectOfItem(Item item)
+ {
+ if(item != null)
+ {
+ return getNextLayoutObjectOfItem(null, item);
+ }
+ return null;
+ }
+
+ /**
+ * Returns the last LayoutObject of a layouted item.
+ *
+ * @param item
+ * @return the LO, or NULL if the item is not layouted
+ */
+ LayoutObject getLastLayoutObjectOfItem(Item item)
+ {
+ if(item != null)
+ {
+ return getPrevLayoutObjectOfItem(null, item);
+ }
+ return null;
+ }
+
+ /**
+ * Update item state in form.
+ *
+ * @param item
+ * @param updateReason
+ * @param param additional parameter
+ */
+ void updateItemState(Item item, int updateReason, Object param)
+ {
+ Logger.method(this, "updateItemState", item,
+ String.valueOf(updateReason), param);
+
+ LayoutObject lo = getFirstLayoutObjectOfItem(item);
+
+ if(lo != null)
+ {
+ getItemLayouter(item).updateItem(item, lo.getControl(), updateReason,
+ param);
+ }
+
+ // Clean reason - without resizing flags
+ int reason = updateReason & Item.UPDATE_SIZE_MASK;
+ switch(reason)
+ {
+ case Item.UPDATE_ADDCOMMAND:
+ {
+ if(isFormCurrent() && param != null)
+ {
+ if(lo != null && param instanceof Command)
+ {
+ lo.addCommand((Command) param);
+ }
+ }
+ break;
+ }
+ case Item.UPDATE_REMOVECOMMAND:
+ {
+ if(isFormCurrent() && param != null)
+ {
+ if(lo != null && param instanceof Command)
+ {
+ lo.removeCommand((Command) param);
+ }
+ }
+ break;
+ }
+ }
+
+ // Check this always - because this is a flag
+ if((updateReason & Item.UPDATE_HEIGHT_CHANGED)
+ == Item.UPDATE_HEIGHT_CHANGED)
+ {
+ resizeItemAndShift(item);
+ }
+ }
+
+ int eswtGetMaxVPosition()
+ {
+ return formComposite.getSize().y - getFormHeight();
+ }
+
+ /**
+ * Called by key Form to compute new vertical coordinate to position form's
+ * content.
+ *
+ * @param swtDir scrolling direction.
+ * @return New vertical position of Form's content.
+ */
+ protected int getNextScrollingPosition(int swtDir)
+ {
+ boolean scrollDown = (swtDir == SWT.ARROW_DOWN
+ || swtDir == SWT.ARROW_RIGHT);
+ int formHeight = getFormHeight();
+ int refPoint;
+ int ret = vPosition;
+ if(scrollDown)
+ {
+ ret += formHeight / 5;
+ refPoint = (vPosition + 1) + formHeight;
+ }
+ else
+ {
+ ret -= formHeight / 5;
+ refPoint = (vPosition - 1);
+ }
+
+ Row row = null;
+ for(int i = 0; i < getRowCount(); i++)
+ {
+ row = getRow(i);
+ if(row.isInsideRow(refPoint)
+ && (row.getRowHeight() < formHeight))
+ {
+ if(scrollDown)
+ {
+ ret = row.getBottomPosition() - formHeight;
+ }
+ else
+ {
+ ret = row.getYShift();
+ }
+ break;
+ }
+ }
+
+ return ret;
+ }
+
+ /**
+ * Set the scrolling to the specified position.<br>
+ * This method also updates the Form's scrollbars.
+ *
+ * @param position new position
+ */
+ void eswtSetScrollingPosition(int position, boolean keyNav)
+ {
+ // check constraints
+ int newVPosition = position;
+ int maxVPos = eswtGetMaxVPosition();
+ newVPosition = Math.min(newVPosition, maxVPos);
+ newVPosition = Math.max(newVPosition, 0);
+
+ vPosition = newVPosition;
+ formComposite.setRedraw(false);
+ formComposite.setOrigin(0, vPosition, keyNav);
+ formComposite.pack();
+ formComposite.setRedraw(true);
+
+ eswtHandleVisibilityChanges();
+ }
+
+ /**
+ * Returns the scrolling position.
+ */
+ protected int getScrollingPosition()
+ {
+ return vPosition;
+ }
+
+ /**
+ * Updates visibility status of all items.
+ */
+ protected void eswtHandleVisibilityChanges()
+ {
+ // Logger.method(this, "eswtHandleVisibilityChanges");
+ boolean shown = false;
+ Item item = null;
+ LayoutObject lo = null;
+ // Go through all LayoutObjects and check/update visibilities
+ while((lo = getNextLayoutObjectOfItem(lo, null)) != null)
+ {
+ // check if owning item is changing
+ if(lo.getOwningItem() != item)
+ {
+ if(item != null)
+ {
+ // set current item's visibility
+ getItemLayouter(item).eswtHandleVisibilityChange(item, shown);
+ }
+ // new item
+ item = lo.getOwningItem();
+ shown = false;
+ }
+
+ // track current item's visibility
+ if(!shown && isFormCurrent() && isPartiallyVisible(lo))
+ {
+ shown = true;
+ }
+ }
+
+ // call it for last item
+ if(item != null)
+ {
+ getItemLayouter(item).eswtHandleVisibilityChange(item, shown);
+ }
+
+ eswtCheckCurrentSelectedItem();
+ }
+
+ /**
+ * Changes item size and does shift of all Rows.
+ *
+ * @param item - item to changeSize.
+ */
+ void resizeItemAndShift(final Item item)
+ {
+ ESWTUIThreadRunner.syncExec(new Runnable()
+ {
+ public void run()
+ {
+ int newVPosition = eswtResizeItemAndShift(item);
+ if(newVPosition != vPosition)
+ {
+ eswtSetScrollingPosition(newVPosition, true);
+ }
+ else
+ {
+ eswtHandleVisibilityChanges();
+ }
+ }
+ });
+ }
+
+ /**
+ * eSWT callback for resizeItemAndShift.
+ *
+ * @param item Item to be resized.
+ * @return new scrolling vPosition
+ */
+ int eswtResizeItemAndShift(Item item)
+ {
+ // save the state of the last row before resizing and Shifting.
+ boolean itemWasVisible = isItemPartiallyVisible(item);
+ Row row = getLastRowOfItem(item);
+ int deltaYShift = row.getRowHeight();
+ // if we un-comment this then when we set true,
+ // focus will jump to first item.
+ // eswtUpdateFormComposite(false);
+ LayoutObject lo = getFirstLayoutObjectOfItem(item);
+ if(lo != null)
+ {
+ getItemLayouter(item).eswtResizeObject(lo);
+ }
+
+ eswtUpdateRow(row);
+
+ /*
+ // to avoid double call of updateRowInternals
+ if (row.getNumLayoutObjects(Item.LAYOUT_SHRINK) > 0
+ || row.getNumLayoutObjects(Item.LAYOUT_EXPAND) > 0) {
+ eswtUpdateRow(row);
+ }
+ else {
+ row.updateRowInternals();
+ }
+ */
+ deltaYShift = row.getRowHeight() - deltaYShift;
+ // row's height change - all remaining rows are shifted with this.
+
+ Row lastRow = getLastRow();
+ if(row != lastRow)
+ {
+ for(int i = rows.indexOf(row) + 1; i < getRowCount(); i++)
+ {
+ row = getRow(i);
+ row.setYShift(row.getYShift() + deltaYShift);
+ eswtUpdateRow(row);
+ }
+ }
+
+ // following code updates scrolling if needed.
+ // need to check where in the form resize happeneed.
+
+ int itemRowYShift = getLastRowOfItem(item).getYShift();
+ // vPosition should be changed in syncexec
+ int newVPosition = vPosition;
+
+ // we need to scroll only if changes happened above the screen.
+ if(newVPosition >= itemRowYShift)
+ {
+ newVPosition = Math.max(0, newVPosition + deltaYShift);
+ }
+ // check to avoid gap in the bottom of the form
+ if(newVPosition + getFormHeight() > lastRow.getBottomPosition())
+ {
+ newVPosition = Math.max(0,
+ lastRow.getBottomPosition() - getFormHeight());
+ }
+
+ eswtUpdateFormComposite(true);
+
+ // formComposite.pack();
+ // formComposite.updateScrollbarSize(lastRow.getBottomPosition());
+
+ if(item == currentSelectedItem)
+ {
+ if(itemWasVisible)
+ {
+ int itemTop = getItemTopPosition(item);
+ int itemBottom = getItemBottomPosition(item);
+ // currentSelectedItem has to be focused if it was focused
+ // before resizing e.g TextField when it is resized by adding a
+ // new row and it was in the bottom of the Screen.
+ if(newVPosition <= itemTop
+ && (newVPosition + getFormHeight()) >= itemBottom)
+ {
+ // do not change vPosition;
+ }
+ else if(newVPosition > itemTop)
+ {
+ newVPosition = itemTop;
+ }
+ else if((newVPosition + getFormHeight()) < itemBottom)
+ {
+ newVPosition = itemBottom - getFormHeight();
+ }
+ }
+ }
+ return newVPosition;
+ }
+
+ /**
+ * Gets layouter that can layout the specified item.
+ *
+ * @param item Item to be layouted.
+ * @return ItemLayouter or null if no Layouter found.
+ */
+ protected final ItemLayouter getItemLayouter(Item item)
+ {
+ if(item instanceof StringItem)
+ {
+ return sIL;
+ }
+ else if(item instanceof ImageItem)
+ {
+ return imIL;
+ }
+ else if(item instanceof Gauge)
+ {
+ return gL;
+ }
+ else if(item instanceof TextField)
+ {
+ return tfL;
+ }
+ else if(item instanceof DateField)
+ {
+ return dfL;
+ }
+ else if(item instanceof ChoiceGroup)
+ {
+ return cgL;
+ }
+ else if(item instanceof CustomItem)
+ {
+ return ciL;
+ }
+ else if(item instanceof Spacer)
+ {
+ return sL;
+ }
+ return null;
+ }
+
+ /**
+ * Returns eSWT Control that represents the item specified.
+ */
+ Control getItemControl(final Item item)
+ {
+ final LayoutObject lo = getFirstLayoutObjectOfItem(item);
+ if(lo != null)
+ {
+ ESWTUIThreadRunner.syncExec(new Runnable()
+ {
+ public void run()
+ {
+ itemMainControl = getItemLayouter(item)
+ .eswtFindSpecificControl(item, lo.getControl());
+ }
+ });
+ return itemMainControl;
+ }
+ return null;
+ }
+
+ void updateScrolling(final int value, final boolean keyNav)
+ {
+ Logger.method("updateScrolling", String.valueOf(value));
+ ESWTUIThreadRunner.syncExec(new Runnable()
+ {
+ public void run()
+ {
+
+ eswtSetScrollingPosition(value, keyNav);
+
+ }
+ });
+ }
+
+ /**
+ * Get current scrolling value.
+ *
+ * @return vPosition.
+ */
+ int getVPosition()
+ {
+ return vPosition;
+ }
+
+
+ private Timer eventTimer = new Timer();
+ private EventGeneratorTask eventTask;
+
+ /**
+ * Reset timer for do layout with a given start index.
+ */
+ private void resetEventTimer(boolean directionUp, int y)
+ {
+ if(eventTimer != null)
+ {
+ if(eventTask != null)
+ {
+ eventTask.cancel();
+ eventTask = null;
+ }
+ // schedule new timer
+ eventTask = new EventGeneratorTask(directionUp, y);
+ eventTimer.schedule(eventTask, Config.DFI_EVENT_TIMER_DELAY);
+ }
+ }
+
+ /**
+ * Form Timer task. Triggers the formComposite to Layout.
+ */
+ class EventGeneratorTask extends TimerTask
+ {
+
+ private boolean isUpDirection;
+ private int localY;
+
+ public EventGeneratorTask(boolean direction, int y)
+ {
+ isUpDirection = direction;
+ localY = y;
+ Logger.info("y is " + localY);
+ }
+
+ public void run()
+ {
+ if(isUpDirection)
+ {
+ localY -= Config.DFI_EVENT_MOVE_DELTA;
+ }
+ else
+ {
+ localY += Config.DFI_EVENT_MOVE_DELTA;
+ }
+ handlePointerEvent(0, localY, SWT.MouseMove);
+ }
+ }
+
+}
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/Gauge.java Fri Jul 23 12:27:20 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/Gauge.java Thu Aug 05 16:07:57 2010 +0300
@@ -23,7 +23,6 @@
*/
public class Gauge extends Item
{
-
/**
* Indefinite constant.
*/
@@ -49,6 +48,13 @@
*/
public static final int INCREMENTAL_UPDATING = 3;
+ /**
+ * If Gauge is changed, reasons for Re-layouting.
+ */
+ static final int UPDATE_MAXVALUE = UPDATE_ITEM_MAX << 1;
+ static final int UPDATE_VALUE = UPDATE_ITEM_MAX << 2;
+
+
private int maxValue;
private int value;
private boolean interactive;
@@ -147,7 +153,7 @@
* that requires eSWT extension.
*/
this.value = checkValue(value, this.maxValue);
- updateParent(UPDATE_CONTENT);
+ updateParent(UPDATE_VALUE);
}
/**
@@ -169,7 +175,7 @@
{
this.maxValue = checkMaxValue(maxValue, interactive);
this.value = checkValue(getValue(), this.maxValue);
- updateParent(UPDATE_CONTENT);
+ updateParent(UPDATE_MAXVALUE);
}
/**
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/GaugeLayouter.java Fri Jul 23 12:27:20 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/GaugeLayouter.java Thu Aug 05 16:07:57 2010 +0300
@@ -38,11 +38,11 @@
/**
* Constructor.
*
- * @param dflp DefaultFormLayoutPolicy
+ * @param aFormLayouter FormLayouter used for layouting.
*/
- GaugeLayouter(DefaultFormLayoutPolicy dflp)
+ GaugeLayouter(FormLayouter aFormLayouter)
{
- super(dflp);
+ super(aFormLayouter);
}
/**
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/ImageItem.java Fri Jul 23 12:27:20 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/ImageItem.java Thu Aug 05 16:07:57 2010 +0300
@@ -26,7 +26,6 @@
*/
public class ImageItem extends Item
{
-
/**
* Left here for source compatibility purposes. Use layout directives from
* Item class instead.
@@ -63,6 +62,13 @@
*/
public static final int LAYOUT_NEWLINE_AFTER = Item.LAYOUT_NEWLINE_AFTER;
+ /**
+ * If ImageItem is changed, reasons for Re-layouting.
+ */
+ static final int UPDATE_ALTTEXT = UPDATE_ITEM_MAX << 1;
+ static final int UPDATE_IMAGE = UPDATE_ITEM_MAX << 2;
+
+
private Image image;
private int appearanceMode;
private String alternateText;
@@ -129,8 +135,12 @@
*/
public void setImage(Image image)
{
+ if((image == null) && (this.image == null))
+ {
+ return;
+ }
this.image = image;
- updateParent(UPDATE_SIZE_CHANGED);
+ updateParent(UPDATE_IMAGE | UPDATE_SIZE_CHANGED);
}
/**
@@ -151,7 +161,7 @@
public void setAltText(String newAltText)
{
alternateText = newAltText;
- updateParent(UPDATE_SIZE_CHANGED);
+ updateParent(UPDATE_ALTTEXT);
}
/**
@@ -173,6 +183,44 @@
}
/**
+ * Adds command to this ImageItem. If same command is already added to this item,
+ * nothing happens.
+ *
+ * @param command A command to be added.
+ * @throws NullPointerException if cmd is null.
+ */
+ public void addCommand(Command command)
+ {
+ int numCmds = getNumCommands();
+
+ super.addCommand(command);
+
+ if((getNumCommands() != numCmds) && (getNumCommands() == 1))
+ {
+ updateParent(UPDATE_SIZE_CHANGED);
+ }
+ }
+
+ /**
+ * Removes command from the ImageItem. If command doesn't exists in this item,
+ * nothing happens.
+ *
+ * @param command The command to be removed.
+ */
+ public void removeCommand(Command command)
+ {
+ int numCmds = getNumCommands();
+
+ super.removeCommand(command);
+
+ if((getNumCommands() != numCmds) && (getNumCommands() == 0))
+
+ {
+ updateParent(UPDATE_SIZE_CHANGED);
+ }
+ }
+
+ /**
* Calculates minimum size of this item.
*
* @return Minimum size.
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/ImageItemLayouter.java Fri Jul 23 12:27:20 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/ImageItemLayouter.java Thu Aug 05 16:07:57 2010 +0300
@@ -18,7 +18,6 @@
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.*;
import org.eclipse.ercp.swt.mobile.CaptionedControl;
@@ -31,29 +30,28 @@
/**
* Constructor.
*
- * @param dflp - DefaultFormLayoutPolicy used for layouting.
+ * @param aFormLayouter FormLayouter used for layouting.
*/
- ImageItemLayouter(DefaultFormLayoutPolicy dflp)
+ ImageItemLayouter(FormLayouter aFormLayouter)
{
- super(dflp);
- }
-
- int eswtGetLabelAlignmentDirective()
- {
- return Item.LAYOUT_BOTTOM;
+ super(aFormLayouter);
}
/**
- * Layout Item in a row.
+ * Creates LayoutObject for the given Item.
*
- * @param row current Row
* @param item Item to layout
+ * @return LayoutObject
*/
- void eswtLayoutItem(Row row, Item item)
+ LayoutObject getLayoutObject(Item item)
{
- LayoutObject lo = new LayoutObject(item, eswtGetControl(formComposite, item));
- dfi.eswtAddNewLayoutObject(lo);
- }
+ LayoutObject lo = formLayouter.getLayoutObject(item);
+ if(lo == null)
+ {
+ lo = new LayoutObject(item, eswtGetControl(formComposite, item));
+ }
+ return lo;
+ }
/**
* Creates the eSWT CaptionedControl or Composite for this item.
@@ -61,10 +59,7 @@
Control eswtGetControl(Composite parent, Item item)
{
Control ret = eswtCreateControl(parent, item);
- Point size = new Point(0,0);
- size.x = item.getLayoutWidth();
- size.y = item.getLayoutHeight();
- eswtCaptionedResize(item, ret, size.x, size.y);
+ eswtCaptionedResize(item, ret, item.getLayoutWidth(), item.getLayoutHeight());
return ret;
}
@@ -73,18 +68,22 @@
*/
static Control eswtCreateControl(Composite parent, Item item)
{
- if(item.hasLabel())
- {
- CaptionedControl captioned = new CaptionedControl(parent, SWT.VERTICAL);
- captioned.setText(item.getLabel());
- eswtSpecificControl(captioned, item);
- return captioned;
- }
- else
- {
- Control ret = eswtSpecificControl(parent, item);
- return ret;
- }
+ CaptionedControl captioned = new CaptionedControl(parent, SWT.VERTICAL);
+ if(item.hasLabel())
+ {
+ captioned.setText(item.getLabel());
+ }
+
+ if(((ImageItem)item).getImage() != null)
+ {
+ eswtSpecificControl(captioned, item);
+ }
+ else
+ {
+ updateControlSize(null, captioned, (ImageItem)item);
+ }
+
+ return captioned;
}
/**
@@ -94,38 +93,10 @@
{
ImageItem imgItem = (ImageItem) item;
- if(item.getNumCommands() == 0)
+ if(imgItem.getNumCommands() == 0)
{
Label imageLabel = new Label(parent, SWT.CENTER);
- imageLabel.setImage(Image.getESWTImage(imgItem.getImage()));
- imageLabel.pack();
- int imageWidth = imageLabel.getBounds().width;
- int imageHeight = imageLabel.getBounds().height;
- int maxWidth = getMaximumItemWidth(item);
- if(imageWidth > maxWidth)
- {
- Point size = imageLabel.computeSize(maxWidth, SWT.DEFAULT);
- //Image Resize has to be done.
- imageLabel.setSize(size.x, size.y);
- imageWidth = size.x;
- imageHeight = size.y;
- }
-
- if(imgItem.hasLabel())
- {
- int labelWidth = Font.getDefaultFont().stringWidth(imgItem.getLabel());
-
- if(labelWidth > imageWidth)
- {
- Point size = parent.computeSize(Math.min(labelWidth, maxWidth), SWT.DEFAULT);
- parent.setSize(size.x, size.y);
- }
- else
- {
- parent.pack();
- }
- }
-
+ constructLabel(imageLabel, parent, imgItem);
return imageLabel;
}
else
@@ -143,54 +114,176 @@
button = new Button(parent, SWT.FLAT | SWT.NONE);
break;
}
- button.setImage(Image.getESWTImage(imgItem.getImage()));
- button.pack();
- int buttonWidth = button.getBounds().width;
- int buttonHeight = button.getBounds().height;
- int maxWidth = getMaximumItemWidth(item);
- if(buttonWidth > maxWidth)
- {
- Point size = button.computeSize(maxWidth, SWT.DEFAULT);
- //Image Resize has to be done.
- button.setSize(size.x, size.y);
- buttonWidth = size.x;
- buttonHeight = size.y;
- }
-
- if(imgItem.hasLabel())
- {
- int labelWidth = Font.getDefaultFont().stringWidth(imgItem.getLabel());
-
- if(labelWidth > buttonWidth)
- {
- Point size = parent.computeSize(Math.min(labelWidth, maxWidth), SWT.DEFAULT);
- parent.setSize(size.x, size.y);
- }
- else
- {
- parent.pack();
- }
- }
-
+ constructButton(button, parent, imgItem);
return button;
}
}
+ static private void constructLabel(Label imageLabel, Composite parent, ImageItem imgItem)
+ {
+ imageLabel.setImage(Image.getESWTImage(imgItem.getImage()));
+ imageLabel.pack();
+ updateControlSize(imageLabel, parent, imgItem);
+ }
+
+ static private void constructButton(Button button, Composite parent, ImageItem imgItem)
+ {
+ button.setImage(Image.getESWTImage(imgItem.getImage()));
+ button.pack();
+ updateControlSize(button, parent, imgItem);
+ }
+
+ static private void updateControlSize(Control control, Composite parent, ImageItem imgItem)
+ {
+ int controlWidth;
+ int controlHeight;
+ int maxWidth = getMaximumItemWidth(imgItem);
+
+ if(control != null)
+ {
+ controlWidth = control.getBounds().width;
+ controlHeight = control.getBounds().height;
+
+ if(controlWidth > maxWidth)
+ {
+ //Image Resize has to be done.
+ Point size = control.computeSize(maxWidth, SWT.DEFAULT);
+ control.setSize(size.x, size.y);
+ controlWidth = size.x;
+ controlHeight = size.y;
+ }
+ }
+ else
+ {
+ controlWidth = maxWidth;
+ }
+
+ if(imgItem.hasLabel())
+ {
+ int labelWidth = Font.getDefaultFont().stringWidth(imgItem.getLabel());
+
+ if(labelWidth > controlWidth)
+ {
+ Point size = parent.computeSize(Math.min(labelWidth, maxWidth), SWT.DEFAULT);
+ parent.setSize(size.x, size.y);
+ return;
+ }
+ }
+ else if(control == null)
+ {
+ parent.setSize(0, 0);
+ return;
+ }
+
+ parent.pack();
+ }
+
/**
* Returns if this eSWT control is Layouter specific.
*/
boolean eswtIsSpecificControl(Item item, Control control)
{
- // No implementation needed
return ((control instanceof Label) || (control instanceof Button));
}
/**
* Updates the values of ImageItem.
*/
- void eswtUpdateItem(Item item, Control control, int reason, Object param)
+ void eswtUpdateItem(Item item, Control control, int aReason, Object param)
{
- // No implementation needed
+ if(!(control instanceof CaptionedControl))
+ {
+ return;
+ }
+
+ ImageItem imgItem = (ImageItem)item;
+ int reason = aReason & Item.UPDATE_SIZE_MASK;
+
+ switch(reason)
+ {
+ case Item.UPDATE_NONE:
+ case ImageItem.UPDATE_ALTTEXT:
+ break;
+
+ case Item.UPDATE_LABEL:
+ {
+ String label = imgItem.getLabel();
+ if(label == null)
+ {
+ label = "";
+ }
+
+ ((CaptionedControl)control).setText(label);
+ Control sCtrl = eswtFindSpecificControl(imgItem, control);
+ updateControlSize(sCtrl, (Composite)control, imgItem);
+ break;
+ }
+
+ case ImageItem.UPDATE_IMAGE:
+ {
+ Control sCtrl = eswtFindSpecificControl(imgItem, control);
+ if(sCtrl != null)
+ {
+ if(imgItem.getImage() != null)
+ {
+ if(sCtrl instanceof Label)
+ {
+ constructLabel((Label)sCtrl, (Composite)control, imgItem);
+ }
+ else if(sCtrl instanceof Button)
+ {
+ constructButton((Button)sCtrl, (Composite)control, imgItem);
+ }
+ }
+ else
+ {
+ sCtrl.dispose();
+ updateControlSize(null, (Composite)control, imgItem);
+ }
+ }
+ else
+ {
+ if(imgItem.getImage() != null)
+ {
+ eswtSpecificControl((Composite)control, imgItem);
+ }
+ }
+ break;
+ }
+
+ case Item.UPDATE_ADDCOMMAND:
+ {
+ Control sCtrl = eswtFindSpecificControl(imgItem, control);
+ if(sCtrl != null)
+ {
+ if((sCtrl instanceof Label) && (imgItem.getNumCommands()==1))
+ {
+ sCtrl.dispose();
+ eswtSpecificControl((Composite)control, imgItem);
+ }
+ }
+ }
+ break;
+
+ case Item.UPDATE_REMOVECOMMAND:
+ {
+ Control sCtrl = eswtFindSpecificControl(imgItem, control);
+ if(sCtrl != null)
+ {
+ if((sCtrl instanceof Button) && (imgItem.getNumCommands()==0))
+ {
+ sCtrl.dispose();
+ eswtSpecificControl((Composite)control, imgItem);
+ }
+ }
+ }
+ break;
+
+ default:
+ {
+ break;
+ }
+ }
}
/**
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/Item.java Fri Jul 23 12:27:20 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/Item.java Thu Aug 05 16:07:57 2010 +0300
@@ -17,6 +17,7 @@
package javax.microedition.lcdui;
import java.util.Vector;
+import java.lang.ref.WeakReference;
import javax.microedition.lcdui.EventDispatcher.LCDUIEvent;
import com.nokia.mj.impl.nokialcdui.ItemControlStateChangeListener;
@@ -136,35 +137,27 @@
static final int LAYOUT_VERTICAL_MASK = LAYOUT_VCENTER; // 48;
-
- static final int UPDATE_NONE = 0;
-
- static final int UPDATE_ADDCOMMAND = 1;
-
- static final int UPDATE_REMOVECOMMAND = 2;
-
/**
- * Item content has changed. Re-layouting not needed.
+ * If Item is changed, reasons for Re-layouting.
*/
- static final int UPDATE_CONTENT = 3; // general update value
-
- static final int UPDATE_REASON_MASK = 255;
+ static final int UPDATE_NONE = 0;
- /**
- * Item height has changed. Re-layouting not needed.
- */
- static final int UPDATE_HEIGHT_CHANGED = 256;
+ static final int UPDATE_ADDCOMMAND = 1;
+ static final int UPDATE_REMOVECOMMAND = 1 << 1;
+ static final int UPDATE_DEFAULTCOMMAND = 1 << 2;
+ static final int UPDATE_ITEMCOMMANDLISTENER = 1 << 3;
+ static final int UPDATE_LABEL = 1 << 4;
+ static final int UPDATE_LAYOUT = 1 << 5;
+ static final int UPDATE_PREFERREDSIZE = 1 << 6;
- /**
- * Item width is changed. Re-layouting asap.
- */
- static final int UPDATE_WIDTH_CHANGED = 512;
-
- /**
- * Item width and height changed. Re-layouting asap.
- */
+ static final int UPDATE_HEIGHT_CHANGED = 1 << 7;
+ static final int UPDATE_WIDTH_CHANGED = 1 << 8;
static final int UPDATE_SIZE_CHANGED =
UPDATE_HEIGHT_CHANGED | UPDATE_WIDTH_CHANGED;
+ static final int UPDATE_SIZE_MASK = ~UPDATE_SIZE_CHANGED;
+
+ static final int UPDATE_ITEM_MAX = 1 << 15;
+
private String label;
@@ -177,7 +170,7 @@
private ItemControlStateChangeListener controlListener;
private Command defaultCommand;
- private Screen parent;
+ private WeakReference wParent;
private int layout;
private int lockedPrefWidth = -1;
@@ -191,11 +184,18 @@
/**
* Sets the parent of this Item.
- * @param parent new Parent. If null, current parent is removed.
+ * @param parent new Parent. If null, current parent is to be removed.
*/
void setParent(Screen parent)
{
- this.parent = parent;
+ if(parent != null)
+ {
+ wParent = new WeakReference(parent);
+ }
+ else
+ {
+ clearParent();
+ }
}
/**
@@ -205,7 +205,27 @@
*/
Screen getParent()
{
- return parent;
+ if(wParent != null)
+ {
+ return (Screen)wParent.get();
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ /**
+ * Clears the Item's parent.
+ *
+ */
+ void clearParent()
+ {
+ if(wParent != null)
+ {
+ wParent.clear();
+ wParent = null;
+ }
}
/**
@@ -221,8 +241,12 @@
throw new IllegalStateException(
MsgRepository.ITEM_EXCEPTION_OWNED_BY_ALERT);
}
+ if((newLabel == null) && (label == null))
+ {
+ return;
+ }
label = newLabel;
- updateParent(UPDATE_SIZE_CHANGED);
+ updateParent(UPDATE_LABEL | UPDATE_SIZE_CHANGED);
}
/**
@@ -276,7 +300,7 @@
}
layout = newLayout;
Logger.method(this, "setLayout", String.valueOf(layout));
- updateParent(UPDATE_SIZE_CHANGED);
+ updateParent(UPDATE_LAYOUT | UPDATE_SIZE_CHANGED);
}
/**
@@ -302,19 +326,7 @@
if(!commands.contains(command))
{
commands.addElement(command);
-
- int reason = UPDATE_ADDCOMMAND;
-
- if(this instanceof StringItem && commands.size() == 1)
- {
- reason |= UPDATE_SIZE_CHANGED;
- }
- if(this instanceof ImageItem && commands.size() == 1)
- {
- reason |= UPDATE_SIZE_CHANGED;
- }
-
- updateParent(reason, command);
+ updateParent(UPDATE_ADDCOMMAND, command);
}
}
@@ -332,21 +344,11 @@
{
// Remove command from commands-vector
commands.removeElement(command);
-
- defaultCommand = null;
-
- int reason = UPDATE_REMOVECOMMAND;
-
- if(this instanceof StringItem && commands.size() == 0)
- {
- reason |= UPDATE_SIZE_CHANGED;
- }
- if(this instanceof ImageItem && commands.size() == 0)
- {
- reason |= UPDATE_SIZE_CHANGED;
- }
-
- updateParent(reason, command);
+ if(defaultCommand == command)
+ {
+ defaultCommand = null;
+ }
+ updateParent(UPDATE_REMOVECOMMAND, command);
}
}
@@ -519,7 +521,7 @@
Logger.method(this, "setPrefSize",
String.valueOf(lockedPrefWidth),
String.valueOf(lockedPrefHeight));
- updateParent(UPDATE_SIZE_CHANGED);
+ updateParent(UPDATE_PREFERREDSIZE | UPDATE_SIZE_CHANGED);
}
/**
@@ -568,7 +570,7 @@
MsgRepository.ITEM_EXCEPTION_NOT_OWNED_BY_FORM);
}
// Notify item state listener
- ((Form) parent).notifyItemStateChanged(this);
+ ((Form) getParent()).notifyItemStateChanged(this);
}
/**
@@ -628,7 +630,7 @@
*/
boolean isContainedInAlert()
{
- return (parent != null && parent instanceof Alert);
+ return ((wParent != null) && (getParent() instanceof Alert));
}
/**
@@ -636,7 +638,7 @@
*/
boolean isContainedInForm()
{
- return (parent != null && parent instanceof Form);
+ return ((wParent != null) && (getParent() instanceof Form));
}
/**
@@ -670,7 +672,7 @@
}
if(isContainedInForm())
{
- ((Form) parent).updateItemState(this, updateReason, param);
+ ((Form) getParent()).updateItemState(this, updateReason, param);
}
}
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/ItemLayouter.java Fri Jul 23 12:27:20 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/ItemLayouter.java Thu Aug 05 16:07:57 2010 +0300
@@ -36,11 +36,11 @@
/**
* Key name for paint listener.
*/
- private static final String FOCUS_LISTENER = "itemfocus";
+ private static final String FOCUS_LISTENER = "FocusListener";
protected static final String MIN_TEXT = "...";
- protected DefaultFormInteraction dfi;
+ protected FormLayouter formLayouter;
protected Composite formComposite;
@@ -112,12 +112,12 @@
/**
* Constructor.
*
- * @param dflp - DefaultFormLayoutPolicy used for layouting.
+ * @param aFormLayouter FormLayouter used for layouting.
*/
- ItemLayouter(DefaultFormLayoutPolicy dflp)
+ ItemLayouter(FormLayouter aFormLayouter)
{
- this.dfi = (DefaultFormInteraction) dflp;
- formComposite = dflp.getForm().getFormComposite();
+ formLayouter = aFormLayouter;
+ formComposite = formLayouter.getForm().getFormComposite();
ESWTUIThreadRunner.syncExec(new Runnable()
{
public void run()
@@ -132,7 +132,7 @@
*/
int eswtGetLabelAlignmentDirective()
{
- return dfi.getLanguageSpecificLayoutDirective();
+ return formLayouter.getLanguageSpecificLayoutDirective();
}
/**
@@ -143,8 +143,8 @@
*/
void eswtLayoutItem(Row row, Item item)
{
- LayoutObject lo = new LayoutObject(item, eswtGetCaptionedControl(item));
- dfi.eswtAddNewLayoutObject(lo);
+ LayoutObject lo = getLayoutObject(item);
+ formLayouter.eswtAddNewLayoutObject(lo);
if(item instanceof CustomItem)
{
ItemControlStateChangeListener listener = item.getItemControlStateChangeListener();
@@ -157,6 +157,22 @@
}
/**
+ * Creates LayoutObject for the given Item.
+ *
+ * @param item Item to layout
+ * @return LayoutObject
+ */
+ LayoutObject getLayoutObject(Item item)
+ {
+ LayoutObject lo = formLayouter.getLayoutObject(item);
+ if(lo == null)
+ {
+ lo = new LayoutObject(item, eswtGetCaptionedControl(item));
+ }
+ return lo;
+ }
+
+ /**
* Wraps this item's control in the necessary composites.<br>
* Based on the item, the result of this method can be:
* <li> specific Control
@@ -169,20 +185,14 @@
*/
final Control eswtGetCaptionedControl(Item item)
{
+ CaptionedControl captioned = new CaptionedControl(formComposite, SWT.VERTICAL);
if(item.hasLabel())
{
- CaptionedControl captioned = new CaptionedControl(formComposite, SWT.VERTICAL);
- captioned.setText(item.getLabel());
- eswtGetControl(captioned, item);
- eswtCaptionedResize(item, captioned, item.getLayoutWidth(), item.getLayoutHeight());
- return captioned;
- }
- else
- {
- Control ret = eswtGetControl(formComposite, item);
- eswtCaptionedResize(item, ret, item.getLayoutWidth(), item.getLayoutHeight());
- return ret;
- }
+ captioned.setText(item.getLabel());
+ }
+ eswtGetControl(captioned, item);
+ eswtCaptionedResize(item, captioned, item.getLayoutWidth(), item.getLayoutHeight());
+ return captioned;
}
/**
@@ -244,7 +254,10 @@
*/
void eswtResizeControl(Item item, Control control, int width, int height)
{
- control.setSize(width, height);
+ if(control != null)
+ {
+ control.setSize(width, height);
+ }
}
/**
@@ -337,12 +350,11 @@
{
public void run()
{
- Control specific = eswtFindSpecificControl(item, control);
- if(specific != null)
+ if(control != null)
{
- if(!specific.isDisposed())
+ if(!control.isDisposed())
{
- eswtUpdateItem(item, specific, reason, param);
+ eswtUpdateItem(item, control, reason, param);
}
else
{
@@ -430,7 +442,7 @@
*/
Control eswtGetFirstControl(Item item)
{
- LayoutObject lo = dfi.getFirstLayoutObjectOfItem(item);
+ LayoutObject lo = formLayouter.getFirstLayoutObjectOfItem(item);
if(lo != null)
{
return lo.getControl();
@@ -446,7 +458,7 @@
*/
Control eswtGetFirstSpecificControl(Item item)
{
- LayoutObject lo = dfi.getFirstLayoutObjectOfItem(item);
+ LayoutObject lo = formLayouter.getFirstLayoutObjectOfItem(item);
if(lo != null)
{
Control control = lo.getControl();
@@ -707,7 +719,7 @@
if(!item.isFocused())
{
// Logger.method(item, "focusGained");
- dfi.eswtSetCurrentSelectedItem(item);
+ formLayouter.eswtSetCurrentSelectedItem(item);
}
}
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/LCDUIInvokerImpl.java Fri Jul 23 12:27:20 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/LCDUIInvokerImpl.java Thu Aug 05 16:07:57 2010 +0300
@@ -62,7 +62,7 @@
if(item.isContainedInForm())
{
Form parentForm = (Form) item.getParent();
- return parentForm.getLayoutPolicy().getItemControl(item);
+ return parentForm.getFormLayouter().getItemControl(item);
}
}
return null;
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/LayoutObject.java Fri Jul 23 12:27:20 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/LayoutObject.java Thu Aug 05 16:07:57 2010 +0300
@@ -108,32 +108,25 @@
Control ret = null;
//If the Control is focusable add the commands to the same.
- if((ctrl instanceof CaptionedControl) || (ctrl.isFocusControl()))
+ if((ctrl instanceof CaptionedControl) || (ctrl instanceof Button)
+ || (ctrl.isFocusControl()))
{
return ctrl;
}
-
- if(ctrl != null)
+ if(ctrl instanceof Composite)
{
- if(ctrl instanceof Button)
- {
- ret = ctrl;
- }
- else if(ctrl instanceof Composite)
+ Control[] children = ((Composite) ctrl).getChildren();
+ for(int i = 0; i < children.length; i++)
{
- Control[] children = ((Composite) ctrl).getChildren();
- for(int i = 0; i < children.length; i++)
+ ret = eswtGetCommandControl(children[i]);
+ if(ret != null)
{
- Control result = eswtGetCommandControl(children[i]);
- if(result != null)
- {
- ret = result;
- break;
- }
+ break;
}
}
}
+
return ret;
}
@@ -146,6 +139,7 @@
{
public void run()
{
+ owningItem = null;
control.dispose();
control = null;
commandControl = null;
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/List.java Fri Jul 23 12:27:20 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/List.java Thu Aug 05 16:07:57 2010 +0300
@@ -466,7 +466,14 @@
{
if(type == Choice.IMPLICIT)
{
- if(cmd != SELECT_COMMAND)
+ if(cmd == null)
+ {
+ if(selectCommand != null)
+ {
+ super.removeCommand(selectCommand);
+ }
+ }
+ else if(cmd != SELECT_COMMAND)
{
addCommand(cmd);
}
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/Row.java Fri Jul 23 12:27:20 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/Row.java Thu Aug 05 16:07:57 2010 +0300
@@ -190,7 +190,6 @@
else
{
layoutObjects.removeElement(lo);
- lo.dispose();
}
}
updateRowInternals();
@@ -199,7 +198,7 @@
/**
* Update item positions in a row.<br>
- * This method called by Layouters or FormLayoutPolicy when row is full and
+ * This method called by FormLayouter when row is full and
* ready for layout.
*/
void updateRowLayout(boolean isLeftToRight)
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/Spacer.java Fri Jul 23 12:27:20 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/Spacer.java Thu Aug 05 16:07:57 2010 +0300
@@ -23,6 +23,10 @@
*/
public class Spacer extends Item
{
+ /**
+ * If Spacer is changed, reasons for Re-layouting.
+ */
+ static final int UPDATE_MINIMUMSIZE = UPDATE_ITEM_MAX << 1;
private int minimumWidth = -1;
private int minimumHeight = -1;
@@ -90,14 +94,17 @@
if(minW != getMinimumWidth())
{
minimumWidth = minW;
- updateReason |= Item.UPDATE_WIDTH_CHANGED;
+ updateReason |= UPDATE_MINIMUMSIZE | UPDATE_SIZE_CHANGED;
}
if(minH != getMinimumHeight())
{
minimumHeight = minH;
- updateReason |= Item.UPDATE_HEIGHT_CHANGED;
+ updateReason |= UPDATE_MINIMUMSIZE | UPDATE_SIZE_CHANGED;
}
- updateParent(updateReason);
+ if(updateReason != Item.UPDATE_NONE)
+ {
+ updateParent(updateReason);
+ }
}
}
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/SpacerLayouter.java Fri Jul 23 12:27:20 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/SpacerLayouter.java Thu Aug 05 16:07:57 2010 +0300
@@ -29,11 +29,27 @@
/**
* Constructor.
*
- * @param dflp DefaultFormLayoutPolicy.
+ * @param aFormLayouter FormLayouter used for layouting.
*/
- SpacerLayouter(DefaultFormLayoutPolicy dflp)
+ SpacerLayouter(FormLayouter aFormLayouter)
{
- super(dflp);
+ super(aFormLayouter);
+ }
+
+ /**
+ * Creates LayoutObject for the given Item.
+ *
+ * @param item Item to layout
+ * @return LayoutObject
+ */
+ LayoutObject getLayoutObject(Item item)
+ {
+ LayoutObject lo = formLayouter.getLayoutObject(item);
+ if(lo == null)
+ {
+ lo = new LayoutObject(item, eswtGetControl(formComposite, item));
+ }
+ return lo;
}
/**
@@ -58,7 +74,7 @@
*/
boolean eswtIsSpecificControl(Item item, Control control)
{
- return true;
+ return (control instanceof Composite);
}
/**
@@ -68,9 +84,38 @@
* @param control eSWT control.
* @param reason reason to update.
*/
- void eswtUpdateItem(Item item, Control control, int reason, Object param)
+ void eswtUpdateItem(Item item, Control control, int aReason, Object param)
{
- // no implementation needed.
+ /*if(control instanceof Composite)
+ {
+ control.setSize(item.getMinimumWidth(), item.getMinimumHeight());
+ }*/
+
+ if(!(control instanceof Composite))
+ {
+ return;
+ }
+
+ Spacer spacer = (Spacer)item;
+ int reason = aReason & Item.UPDATE_SIZE_MASK;
+
+ switch(reason)
+ {
+ case Item.UPDATE_NONE:
+ break;
+
+ case Spacer.UPDATE_MINIMUMSIZE:
+ {
+ Control sCtrl = eswtFindSpecificControl(spacer, control);
+ sCtrl.setSize(item.getMinimumWidth(), item.getMinimumHeight());
+ break;
+ }
+
+ default:
+ {
+ break;
+ }
+ }
}
}
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/StringItem.java Fri Jul 23 12:27:20 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/StringItem.java Thu Aug 05 16:07:57 2010 +0300
@@ -23,6 +23,11 @@
*/
public class StringItem extends Item
{
+ /**
+ * If StringItem is changed, reasons for Re-layouting.
+ */
+ static final int UPDATE_FONT = UPDATE_ITEM_MAX << 1;
+ static final int UPDATE_TEXT = UPDATE_ITEM_MAX << 2;
private String text;
private int appearanceMode;
@@ -90,7 +95,7 @@
{
text = newTxt;
}
- updateParent(UPDATE_SIZE_CHANGED);
+ updateParent(UPDATE_TEXT);
}
/**
@@ -113,7 +118,7 @@
public void setFont(Font f)
{
font = (f == null ? Font.getDefaultFont() : f);
- updateParent(UPDATE_SIZE_CHANGED);
+ updateParent(UPDATE_FONT);
}
/**
@@ -136,6 +141,39 @@
}
/**
+ * Adds command to this StringItem. If same command is already added to this item,
+ * nothing happens.
+ *
+ * @param command A command to be added.
+ * @throws NullPointerException if cmd is null.
+ */
+ public void addCommand(Command command)
+ {
+ super.addCommand(command);
+
+ if(getCommands().size() == 1)
+ {
+ updateParent(UPDATE_SIZE_CHANGED);
+ }
+ }
+
+ /**
+ * Removes command from the StringItem. If command doesn't exists in this item,
+ * nothing happens.
+ *
+ * @param command The command to be removed.
+ */
+ public void removeCommand(Command command)
+ {
+ super.removeCommand(command);
+
+ if(getCommands().size() == 0)
+ {
+ updateParent(UPDATE_SIZE_CHANGED);
+ }
+ }
+
+ /**
* Calculates minimum size of this item.
*
* @return Minimum size.
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/StringItemLayouter.java Fri Jul 23 12:27:20 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/StringItemLayouter.java Thu Aug 05 16:07:57 2010 +0300
@@ -46,11 +46,11 @@
/**
* Constructor.
*
- * @param dflp DefaultFormLayoutPolicy
+ * @param aFormLayouter FormLayouter used for layouting.
*/
- StringItemLayouter(DefaultFormLayoutPolicy dflp)
+ StringItemLayouter(FormLayouter aFormLayouter)
{
- super(dflp);
+ super(aFormLayouter);
}
/**
@@ -162,8 +162,9 @@
if(stringItem.getAppearanceMode() == StringItem.BUTTON)
{
// BUTTON
- dfi.eswtAddNewLayoutObject(
- new LayoutObject(item, eswtGetCaptionedControl(item)));
+ LayoutObject lo = formLayouter.getLayoutObject(item);
+ formLayouter.eswtAddNewLayoutObject(lo == null ?
+ new LayoutObject(item, eswtGetCaptionedControl(item)) : lo);
}
else
{
@@ -203,7 +204,7 @@
String label = item.getLabel();
Vector strings = StringWrapper.wrapString(item.getText(),
- item.getFont(), dfi.getForm().getLeftRightLanguage(),
+ item.getFont(), formLayouter.getForm().getLeftRightLanguage(),
row.getRowWidth(), row.getFreeSpace());
if(strings != null)
@@ -212,7 +213,7 @@
{
// create primitive StringItem
Control control = eswtCreateLabeledPrimitiveStringItem(
- dfi.getForm().getFormComposite(),
+ formLayouter.getForm().getFormComposite(),
(String) strings.elementAt(i),
label, item.getFont(), isHyperlink,
getMaximumItemWidth(item));
@@ -221,8 +222,9 @@
label = null;
// layoutObject which represent primitive StringItem
- dfi.eswtAddNewLayoutObject(
- new LayoutObject(item, control), i != 0);
+ LayoutObject lo = formLayouter.getLayoutObject(item);
+ formLayouter.eswtAddNewLayoutObject((lo == null ?
+ new LayoutObject(item, control) : lo), i != 0);
}
}
}
@@ -246,7 +248,7 @@
int height = item.getPreferredHeight();
Vector strings = StringWrapper.wrapString(item.getText(),
- item.getFont(), dfi.getForm().getLeftRightLanguage(),
+ item.getFont(), formLayouter.getForm().getLeftRightLanguage(),
width, width);
// Create composite which will contain the lines of locked stringitem:
@@ -301,7 +303,8 @@
label = null;
}
}
- dfi.eswtAddNewLayoutObject(new LayoutObject(item, comp), false);
+ LayoutObject lo = formLayouter.getLayoutObject(item);
+ formLayouter.eswtAddNewLayoutObject((lo == null ? new LayoutObject(item, comp) : lo), false);
}
/**
@@ -354,10 +357,10 @@
int objectWidth = Math.max(textWidth, headerWidth);
header.setLocation(ItemLayouter.getXLocation(objectWidth,
- headerWidth, dfi.getLanguageSpecificLayoutDirective()), 0);
+ headerWidth, formLayouter.getLanguageSpecificLayoutDirective()), 0);
text.setLocation(ItemLayouter.getXLocation(objectWidth, textWidth,
- dfi.getLanguageSpecificLayoutDirective()),
+ formLayouter.getLanguageSpecificLayoutDirective()),
header.getBounds().height);
comp.pack();
@@ -657,7 +660,7 @@
{
LayoutObject lo = null;
Control c = null;
- while((lo = dfi.getNextLayoutObjectOfItem(lo, item)) != null)
+ while((lo = formLayouter.getNextLayoutObjectOfItem(lo, item)) != null)
{
if((c = lo.getControl()) != null)
{
@@ -778,7 +781,7 @@
{
Logger.method(this, "widgetSelected");
e.doit = false;
- Item item = dfi.getCurrentSelectedItem();
+ Item item = formLayouter.getCurrentSelectedItem();
item.callCommandAction(item.getMSKCommand());
}
}
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/TextBox.java Fri Jul 23 12:27:20 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/TextBox.java Thu Aug 05 16:07:57 2010 +0300
@@ -286,6 +286,9 @@
public void setConstraints(int newConstraints)
{
textWrapper.setConstraints(newConstraints);
+
+ if(!textWrapper.isValidText(getString() , textWrapper.getTypeConstraint(newConstraints)))
+ setString("");
}
/**
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/TextField.java Fri Jul 23 12:27:20 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/TextField.java Thu Aug 05 16:07:57 2010 +0300
@@ -78,10 +78,15 @@
public static final int CONSTRAINT_MASK = 65535; // 0xFFFF
/**
- * Constant used by layouter to update TextField when setInitialInputMode
- * was called.
+ * If TextField is changed, reasons for Re-layouting.
*/
- static final int UPDATE_INITIAL_INPUT_MODE = 8;
+ static final int UPDATE_REASON_DELETE = UPDATE_ITEM_MAX << 1;
+ static final int UPDATE_REASON_INSERT = UPDATE_ITEM_MAX << 2;
+ static final int UPDATE_CHARS = UPDATE_ITEM_MAX << 3;
+ static final int UPDATE_CONSTRAINTS = UPDATE_ITEM_MAX << 4;
+ static final int UPDATE_INITIALINPUTMODE = UPDATE_ITEM_MAX << 5;
+ static final int UPDATE_MAXSIZE = UPDATE_ITEM_MAX << 6;
+ static final int UPDATE_STRING = UPDATE_ITEM_MAX << 7;
private TextWrapper textWrapper;
@@ -132,7 +137,7 @@
{
textWrapper.setContent(newTxt);
linesCount = 0;
- updateParent(Item.UPDATE_CONTENT | Item.UPDATE_HEIGHT_CHANGED);
+ updateParent(UPDATE_STRING);
}
/**
@@ -182,7 +187,7 @@
}
textWrapper.setContent(extractedString);
linesCount = 0;
- updateParent(Item.UPDATE_CONTENT | Item.UPDATE_HEIGHT_CHANGED);
+ updateParent(UPDATE_CHARS);
}
/**
@@ -195,7 +200,7 @@
{
textWrapper.insert(newTxt, position);
linesCount = 0;
- updateParent(Item.UPDATE_CONTENT | Item.UPDATE_HEIGHT_CHANGED);
+ updateParent(UPDATE_REASON_INSERT);
}
/**
@@ -225,7 +230,7 @@
}
textWrapper.insert(extractedString, position);
linesCount = 0;
- updateParent(Item.UPDATE_CONTENT | Item.UPDATE_HEIGHT_CHANGED);
+ updateParent(UPDATE_REASON_INSERT);
}
/**
@@ -238,7 +243,7 @@
{
textWrapper.delete(offset, length);
linesCount = 0;
- updateParent(Item.UPDATE_CONTENT | Item.UPDATE_HEIGHT_CHANGED);
+ updateParent(UPDATE_REASON_DELETE);
}
/**
@@ -262,7 +267,7 @@
{
textWrapper.setMaxSize(newMaxSize);
linesCount = 0;
- updateParent(Item.UPDATE_CONTENT | Item.UPDATE_HEIGHT_CHANGED);
+ updateParent(UPDATE_MAXSIZE);
return textWrapper.getMaxSize();
}
@@ -284,7 +289,10 @@
public void setConstraints(int newConstraints)
{
textWrapper.setConstraints(newConstraints);
- updateParent(Item.UPDATE_CONTENT | Item.UPDATE_SIZE_CHANGED);
+ updateParent(UPDATE_CONSTRAINTS);
+ if(!textWrapper.isValidText(getString() , textWrapper.getTypeConstraint(newConstraints)))
+ setString("");
+ updateParent(UPDATE_STRING | UPDATE_SIZE_CHANGED);
}
/**
@@ -305,7 +313,7 @@
public void setInitialInputMode(String inputMode)
{
textWrapper.setInputMode(inputMode);
- updateParent(UPDATE_INITIAL_INPUT_MODE);
+ updateParent(UPDATE_INITIALINPUTMODE);
}
/**
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/TextFieldLayouter.java Fri Jul 23 12:27:20 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/TextFieldLayouter.java Thu Aug 05 16:07:57 2010 +0300
@@ -58,11 +58,11 @@
/**
* Constructor.
*
- * @param dflp DefaultFormLayoutPolicy`
+ * @param aFormLayouter FormLayouter used for layouting.
*/
- TextFieldLayouter(DefaultFormLayoutPolicy dflp)
+ TextFieldLayouter(FormLayouter aFormLayouter)
{
- super(dflp);
+ super(aFormLayouter);
}
/**
@@ -112,6 +112,24 @@
static boolean checkText(final int constraint, final String text)
{
isCorrectText = true;
+
+ try
+ {
+ if(constraint == TextField.NUMERIC && !text.equals(""))
+ {
+ Integer.parseInt(text);
+ }
+ else if(constraint == TextField.DECIMAL && !text.equals(""))
+ {
+ Float.parseFloat(text);
+ }
+ }
+ catch( NumberFormatException e )
+ {
+ // Illegal text
+ return false;
+ }
+
ESWTUIThreadRunner.syncExec(new Runnable()
{
public void run()
@@ -149,7 +167,7 @@
if(textfield.getInitialInputMode() != null)
{
- eswtUpdateItem(textfield, te, TextField.UPDATE_INITIAL_INPUT_MODE,
+ eswtUpdateItem(textfield, te, TextField.UPDATE_INITIALINPUTMODE,
null);
}
return te;
@@ -178,16 +196,16 @@
void eswtUpdateItem(Item item, Control control, int reason, Object param)
{
TextField textfield = (TextField) item;
- if(reason == Item.UPDATE_CONTENT)
- {
- TextWrapper.eswtSetContent(control, textfield.getString());
- }
- else if(reason == TextField.UPDATE_INITIAL_INPUT_MODE)
+ if(reason == TextField.UPDATE_INITIALINPUTMODE)
{
TextWrapper.eswtSetInputMode(control,
textfield.getInitialInputMode(),
textfield.getConstraints());
}
+ else
+ {
+ TextWrapper.eswtSetContent(control, textfield.getString());
+ }
}
/**
@@ -413,7 +431,7 @@
textfield.internalSetLinesCount(lines);
Control control = eswtGetFirstControl(textfield);
if(control.getSize().y + te.getLineHeight()
- + Config.TEXTFIELD_MARGIN <= dfi.getFormHeight())
+ + Config.TEXTFIELD_MARGIN <= formLayouter.getFormHeight())
{
textfield.updateParent(Item.UPDATE_HEIGHT_CHANGED);
}
@@ -490,9 +508,9 @@
{
// this is needed if focus was changed with touch.
// so ne scrolling was done in DFI.
- if(!dfi.isItemFullyVisible(textfield))
+ if(!formLayouter.isItemFullyVisible(textfield))
{
- dfi.eswtScrollToItem(textfield);
+ formLayouter.eswtScrollToItem(textfield);
}
textfield.internalSetCaretPosition(
TextWrapper.eswtGetCaretPosition((Control) keyEvent.widget));
--- a/javauis/m2g_qt/.cproject Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,257 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<?fileVersion 4.0.0?>
-
-<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
-<storageModule buildFromInf="true" buildingTestComps="true" cleanLevel="0" concurrentBuildJobs="4" defaultMMPChangedAction="0" extraSBSv2Args="" infBuildComponents="" infFileLocation="build\bld.inf" macrosFile="" makeEngineToUse="make" manageDependencies="true" moduleId="com.nokia.carbide.cdt.builder.carbideCPPBuilder" overrideMakeEngine="false" overrideWorkspaceSettings="false" promptForMMPChangedAction="true" useConcurrentBuilding="true" useDebugMode="false" useIncrementalBuilder="false" useKeepGoing="false" useMMPMacros="true"/>
-<storageModule moduleId="org.eclipse.cdt.core.settings">
-<cconfiguration id="Emulator Debug (WINSCW) [mcl_wk_26]">
-<storageModule buildSystemId="com.nokia.carbide.cdt.builder.CarbideConfigurationDataProvider" id="Emulator Debug (WINSCW) [mcl_wk_26]" moduleId="org.eclipse.cdt.core.settings" name="Emulator Debug (WINSCW) [mcl_wk_26]">
-<externalSettings/>
-<extensions>
-<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
-<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
-<extension id="com.nokia.cdt.debug.cw.symbian.SymbianE32" point="org.eclipse.cdt.core.BinaryParser"/>
-<extension id="com.nokia.carbide.cdt.builder.MakmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.CarbideMakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.SBSv2ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.MWLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.RCOMPErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.MWCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.MakeDefErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-</extensions>
-</storageModule>
-<storageModule moduleId="CarbideConfigurationDataProvider">
-<ENV_VAR_DATA_ID/>
-<ARGUMENTS_DATA_ID ABLDFREEZEARGSSTORAGE="-r"/>
-<ROM_BUILDER_DATA_ID ROMBUILDWORKINGDIRECTORYSTORAGE="T:\epoc32\rom\"/>
-</storageModule>
-<storageModule filesCache="T:\epoc32\include\platform_paths.hrh;T:\sf\app\jrt\javauis\m2g_qt\build\javam2g_0x2002DCBD.mmp;T:\sf\app\jrt\javauis\m2g_qt\build\bld.inf;" includesCache="T:/sf/app/jrt/javauis/m2g_qt/build[LOCAL];T:/epoc32/include/mw/QtCore;T:/epoc32/include/mw/QtGui;T:/epoc32/include/mw;T:/sf/mw/qt/mkspecs/common/symbian;T:/epoc32/include;T:/epoc32/include/stdapis;T:/epoc32/include/stdapis/sys;T:/epoc32/include/platform/mw;T:/epoc32/include/platform;T:/epoc32/include/platform/loc;T:/epoc32/include/platform/mw/loc;T:/epoc32/include/platform/loc/sc;T:/epoc32/include/platform/mw/loc/sc;T:/epoc32/include/app;T:/epoc32/include/platform/app;T:/epoc32/include/platform/app/loc;T:/epoc32/include/platform/app/loc/sc;T:/epoc32/include/stdapis/openssl;T:/sf/app/jrt/javauis/m2g_qt/inc;T:/sf/app/jrt/javauis/inc;T:/sf/app/jrt/inc;T:/sf/app/jrt/javauis/m2g_qt/src;T:/sf/app/jrt/javauis/m2g_qt/src/jni;T:/sf/app/jrt/javauis/eswt_qt/org.eclipse.ercp.swt.s60/native/inc;T:/sf/app/jrt/javauis/lcdui_qt/lcdgr/inc;T:/sf/app/jrt/javauis/lcdui_qt/javalcdui/inc;T:/sf/app/jrt/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics;T:/epoc32/include/stdapis/stlportv5;T:/sf/app/jrt/javauis/m2g_qt/build;T:/epoc32/build/jrt/javabuild/inc.javah;" macrosCache="QT_CORE_LIB;__DLL__;RD_JAVA_APPLICATION_SETTINGS_QT;RD_JAVA_OPENLCDUI_ENABLED;RD_JAVA_HTTP_EMC_ENABLED;__WINSCW__;RD_JAVA_UI_QT;SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK;RD_JAVA_S60_RELEASE_5_0_ONWARDS;RD_JAVA_SYMBIAN_TARGET;__SERIES60_3X__;__S60_5X__;__CW32__;UNICODE;RD_JAVA_S60_RELEASE_10_1;J9EPOC32;_UNICODE;RD_JAVA_EPOCALLOWDLLDATA_FIX;RD_JAVA_PREWARM;__SUPPORT_CPP_EXCEPTIONS__;RD_JAVA_INSTALLERUI_ENABLED;RD_JAVA_S60_RELEASE_10_1_ONWARDS;RD_JAVA_PROXIMITY_LISTENER_ENABLED;RD_JAVA_STDCPPV5;RD_JAVA_ADVANCED_TACTILE_FEEDBACK;OPENLCDUI_ENABLED;__SYMBIAN32__;QT_KEYPAD_NAVIGATION;RD_JAVA_OPENC_BETA_PATCH;RD_JAVA_NGA_ENABLED;RD_JAVA_S60_RELEASE_9_2_ONWARDS;QT_USE_MATH_H_FLOATS;__S60_3X__;__WINS__;QT_GUI_LIB;RD_JAVA_MIDPRMS_DB;QT_SOFTKEYS_ENABLED;__S60_50__;_DEBUG;" moduleId="configDataCache" sourcesCache="/javam2g_0x2002DCBD/build;/javam2g_0x2002DCBD/inc;/javam2g_0x2002DCBD/src;/javam2g_0x2002DCBD/src/jni;" timestampCache="1278586007160" useMmpMacrosCache="true"/>
-<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
-</cconfiguration>
-<cconfiguration id="Emulator Release (WINSCW) [mcl_wk_26]">
-<storageModule buildSystemId="com.nokia.carbide.cdt.builder.CarbideConfigurationDataProvider" id="Emulator Release (WINSCW) [mcl_wk_26]" moduleId="org.eclipse.cdt.core.settings" name="Emulator Release (WINSCW) [mcl_wk_26]">
-<externalSettings/>
-<extensions>
-<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
-<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
-<extension id="com.nokia.cdt.debug.cw.symbian.SymbianE32" point="org.eclipse.cdt.core.BinaryParser"/>
-<extension id="com.nokia.carbide.cdt.builder.MakmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.CarbideMakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.SBSv2ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.MWLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.RCOMPErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.MWCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.MakeDefErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-</extensions>
-</storageModule>
-<storageModule moduleId="CarbideConfigurationDataProvider">
-<ENV_VAR_DATA_ID/>
-<ARGUMENTS_DATA_ID ABLDFREEZEARGSSTORAGE="-r"/>
-<ROM_BUILDER_DATA_ID ROMBUILDWORKINGDIRECTORYSTORAGE="T:\epoc32\rom\"/>
-</storageModule>
-<storageModule filesCache="T:\epoc32\include\platform_paths.hrh;T:\sf\app\jrt\javauis\m2g_qt\build\javam2g_0x2002DCBD.mmp;T:\sf\app\jrt\javauis\m2g_qt\build\bld.inf;" includesCache="T:/sf/app/jrt/javauis/m2g_qt/build[LOCAL];T:/epoc32/include/mw/QtCore;T:/epoc32/include/mw/QtGui;T:/epoc32/include/mw;T:/sf/mw/qt/mkspecs/common/symbian;T:/epoc32/include;T:/epoc32/include/stdapis;T:/epoc32/include/stdapis/sys;T:/epoc32/include/platform/mw;T:/epoc32/include/platform;T:/epoc32/include/platform/loc;T:/epoc32/include/platform/mw/loc;T:/epoc32/include/platform/loc/sc;T:/epoc32/include/platform/mw/loc/sc;T:/epoc32/include/app;T:/epoc32/include/platform/app;T:/epoc32/include/platform/app/loc;T:/epoc32/include/platform/app/loc/sc;T:/epoc32/include/stdapis/openssl;T:/sf/app/jrt/javauis/m2g_qt/inc;T:/sf/app/jrt/javauis/inc;T:/sf/app/jrt/inc;T:/sf/app/jrt/javauis/m2g_qt/src;T:/sf/app/jrt/javauis/m2g_qt/src/jni;T:/sf/app/jrt/javauis/eswt_qt/org.eclipse.ercp.swt.s60/native/inc;T:/sf/app/jrt/javauis/lcdui_qt/lcdgr/inc;T:/sf/app/jrt/javauis/lcdui_qt/javalcdui/inc;T:/sf/app/jrt/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics;T:/epoc32/include/stdapis/stlportv5;T:/sf/app/jrt/javauis/m2g_qt/build;T:/epoc32/build/jrt/javabuild/inc.javah;" macrosCache="QT_CORE_LIB;__DLL__;RD_JAVA_APPLICATION_SETTINGS_QT;RD_JAVA_OPENLCDUI_ENABLED;NDEBUG;RD_JAVA_HTTP_EMC_ENABLED;__WINSCW__;RD_JAVA_UI_QT;SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK;RD_JAVA_S60_RELEASE_5_0_ONWARDS;RD_JAVA_SYMBIAN_TARGET;__SERIES60_3X__;__S60_5X__;__CW32__;UNICODE;RD_JAVA_S60_RELEASE_10_1;J9EPOC32;_UNICODE;RD_JAVA_EPOCALLOWDLLDATA_FIX;RD_JAVA_PREWARM;__SUPPORT_CPP_EXCEPTIONS__;RD_JAVA_INSTALLERUI_ENABLED;RD_JAVA_S60_RELEASE_10_1_ONWARDS;RD_JAVA_PROXIMITY_LISTENER_ENABLED;RD_JAVA_STDCPPV5;RD_JAVA_ADVANCED_TACTILE_FEEDBACK;OPENLCDUI_ENABLED;__SYMBIAN32__;QT_KEYPAD_NAVIGATION;RD_JAVA_OPENC_BETA_PATCH;RD_JAVA_NGA_ENABLED;RD_JAVA_S60_RELEASE_9_2_ONWARDS;QT_USE_MATH_H_FLOATS;__S60_3X__;__WINS__;QT_GUI_LIB;RD_JAVA_MIDPRMS_DB;QT_SOFTKEYS_ENABLED;__S60_50__;" moduleId="configDataCache" sourcesCache="/javam2g_0x2002DCBD/build;/javam2g_0x2002DCBD/inc;/javam2g_0x2002DCBD/src;/javam2g_0x2002DCBD/src/jni;" timestampCache="1278586008004" useMmpMacrosCache="true"/>
-</cconfiguration>
-<cconfiguration id="Phone Debug (ARMV5) [mcl_wk_26]">
-<storageModule buildSystemId="com.nokia.carbide.cdt.builder.CarbideConfigurationDataProvider" id="Phone Debug (ARMV5) [mcl_wk_26]" moduleId="org.eclipse.cdt.core.settings" name="Phone Debug (ARMV5) [mcl_wk_26]">
-<externalSettings/>
-<extensions>
-<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
-<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
-<extension id="com.nokia.cdt.debug.cw.symbian.SymbianE32" point="org.eclipse.cdt.core.BinaryParser"/>
-<extension id="com.nokia.carbide.cdt.builder.MakmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.RVCTLinkerErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.CarbideMakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.SBSv2ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.Elf2E32ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.RCOMPErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.MakeDefErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.RVCTCompilerErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-</extensions>
-</storageModule>
-<storageModule moduleId="CarbideConfigurationDataProvider">
-<ENV_VAR_DATA_ID/>
-<ARGUMENTS_DATA_ID ABLDFREEZEARGSSTORAGE="-r"/>
-<ROM_BUILDER_DATA_ID ROMBUILDWORKINGDIRECTORYSTORAGE="T:\epoc32\rom\"/>
-</storageModule>
-<storageModule filesCache="T:\epoc32\include\platform_paths.hrh;T:\sf\app\jrt\javauis\m2g_qt\build\javam2g_0x2002DCBD.mmp;T:\sf\app\jrt\javauis\m2g_qt\build\bld.inf;" includesCache="T:/sf/app/jrt/javauis/m2g_qt/build[LOCAL];T:/epoc32/include/mw/QtCore;T:/epoc32/include/mw/QtGui;T:/epoc32/include/mw;T:/sf/mw/qt/mkspecs/common/symbian;T:/epoc32/include;T:/epoc32/include/stdapis;T:/epoc32/include/stdapis/sys;T:/epoc32/include/platform/mw;T:/epoc32/include/platform;T:/epoc32/include/platform/loc;T:/epoc32/include/platform/mw/loc;T:/epoc32/include/platform/loc/sc;T:/epoc32/include/platform/mw/loc/sc;T:/epoc32/include/app;T:/epoc32/include/platform/app;T:/epoc32/include/platform/app/loc;T:/epoc32/include/platform/app/loc/sc;T:/epoc32/include/stdapis/openssl;T:/sf/app/jrt/javauis/m2g_qt/inc;T:/sf/app/jrt/javauis/inc;T:/sf/app/jrt/inc;T:/sf/app/jrt/javauis/m2g_qt/src;T:/sf/app/jrt/javauis/m2g_qt/src/jni;T:/sf/app/jrt/javauis/eswt_qt/org.eclipse.ercp.swt.s60/native/inc;T:/sf/app/jrt/javauis/lcdui_qt/lcdgr/inc;T:/sf/app/jrt/javauis/lcdui_qt/javalcdui/inc;T:/sf/app/jrt/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics;T:/epoc32/include/stdapis/stlportv5;T:/sf/app/jrt/javauis/m2g_qt/build;T:/epoc32/build/jrt/javabuild/inc.javah;" macrosCache="QT_CORE_LIB;__DLL__;RD_JAVA_APPLICATION_SETTINGS_QT;RD_JAVA_OPENLCDUI_ENABLED;RD_JAVA_HTTP_EMC_ENABLED;RD_JAVA_UI_QT;__ARMCC_2_2__;SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK;RD_JAVA_S60_RELEASE_5_0_ONWARDS;RD_JAVA_SYMBIAN_TARGET;__SERIES60_3X__;__S60_5X__;__GENERIC_MARM__;UNICODE;RD_JAVA_S60_RELEASE_10_1;__EABI__;J9EPOC32;_UNICODE;RD_JAVA_EPOCALLOWDLLDATA_FIX;RD_JAVA_PREWARM;__SUPPORT_CPP_EXCEPTIONS__;RD_JAVA_INSTALLERUI_ENABLED;__MARM_ARMV5__;RD_JAVA_S60_RELEASE_10_1_ONWARDS;RD_JAVA_PROXIMITY_LISTENER_ENABLED;RD_JAVA_STDCPPV5;RD_JAVA_ADVANCED_TACTILE_FEEDBACK;__ARMCC__;OPENLCDUI_ENABLED;__SYMBIAN32__;QT_KEYPAD_NAVIGATION;RD_JAVA_OPENC_BETA_PATCH;RD_JAVA_NGA_ENABLED;RD_JAVA_S60_RELEASE_9_2_ONWARDS;__MARM__;QT_USE_MATH_H_FLOATS;__S60_3X__;__ARMCC_2__;__EPOC32__;QT_GUI_LIB;RD_JAVA_MIDPRMS_DB;QT_SOFTKEYS_ENABLED;_DEBUG;__S60_50__;" moduleId="configDataCache" sourcesCache="/javam2g_0x2002DCBD/build;/javam2g_0x2002DCBD/inc;/javam2g_0x2002DCBD/src;/javam2g_0x2002DCBD/src/jni;" timestampCache="1278586008441" useMmpMacrosCache="true"/>
-</cconfiguration>
-<cconfiguration id="Phone Release (ARMV5) [mcl_wk_26]">
-<storageModule buildSystemId="com.nokia.carbide.cdt.builder.CarbideConfigurationDataProvider" id="Phone Release (ARMV5) [mcl_wk_26]" moduleId="org.eclipse.cdt.core.settings" name="Phone Release (ARMV5) [mcl_wk_26]">
-<externalSettings/>
-<extensions>
-<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
-<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
-<extension id="com.nokia.cdt.debug.cw.symbian.SymbianE32" point="org.eclipse.cdt.core.BinaryParser"/>
-<extension id="com.nokia.carbide.cdt.builder.MakmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.RVCTLinkerErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.CarbideMakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.SBSv2ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.Elf2E32ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.RCOMPErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.MakeDefErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.RVCTCompilerErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-</extensions>
-</storageModule>
-<storageModule moduleId="CarbideConfigurationDataProvider">
-<ENV_VAR_DATA_ID/>
-<ARGUMENTS_DATA_ID ABLDFREEZEARGSSTORAGE="-r"/>
-<ROM_BUILDER_DATA_ID ROMBUILDWORKINGDIRECTORYSTORAGE="T:\epoc32\rom\"/>
-</storageModule>
-<storageModule filesCache="T:\epoc32\include\platform_paths.hrh;T:\sf\app\jrt\javauis\m2g_qt\build\javam2g_0x2002DCBD.mmp;T:\sf\app\jrt\javauis\m2g_qt\build\bld.inf;" includesCache="T:/sf/app/jrt/javauis/m2g_qt/build[LOCAL];T:/epoc32/include/mw/QtCore;T:/epoc32/include/mw/QtGui;T:/epoc32/include/mw;T:/sf/mw/qt/mkspecs/common/symbian;T:/epoc32/include;T:/epoc32/include/stdapis;T:/epoc32/include/stdapis/sys;T:/epoc32/include/platform/mw;T:/epoc32/include/platform;T:/epoc32/include/platform/loc;T:/epoc32/include/platform/mw/loc;T:/epoc32/include/platform/loc/sc;T:/epoc32/include/platform/mw/loc/sc;T:/epoc32/include/app;T:/epoc32/include/platform/app;T:/epoc32/include/platform/app/loc;T:/epoc32/include/platform/app/loc/sc;T:/epoc32/include/stdapis/openssl;T:/sf/app/jrt/javauis/m2g_qt/inc;T:/sf/app/jrt/javauis/inc;T:/sf/app/jrt/inc;T:/sf/app/jrt/javauis/m2g_qt/src;T:/sf/app/jrt/javauis/m2g_qt/src/jni;T:/sf/app/jrt/javauis/eswt_qt/org.eclipse.ercp.swt.s60/native/inc;T:/sf/app/jrt/javauis/lcdui_qt/lcdgr/inc;T:/sf/app/jrt/javauis/lcdui_qt/javalcdui/inc;T:/sf/app/jrt/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics;T:/epoc32/include/stdapis/stlportv5;T:/sf/app/jrt/javauis/m2g_qt/build;T:/epoc32/build/jrt/javabuild/inc.javah;" macrosCache="QT_CORE_LIB;__DLL__;RD_JAVA_APPLICATION_SETTINGS_QT;RD_JAVA_OPENLCDUI_ENABLED;NDEBUG;RD_JAVA_HTTP_EMC_ENABLED;RD_JAVA_UI_QT;__ARMCC_2_2__;SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK;RD_JAVA_S60_RELEASE_5_0_ONWARDS;RD_JAVA_SYMBIAN_TARGET;__SERIES60_3X__;__S60_5X__;__GENERIC_MARM__;UNICODE;RD_JAVA_S60_RELEASE_10_1;__EABI__;J9EPOC32;_UNICODE;RD_JAVA_EPOCALLOWDLLDATA_FIX;RD_JAVA_PREWARM;__SUPPORT_CPP_EXCEPTIONS__;RD_JAVA_INSTALLERUI_ENABLED;__MARM_ARMV5__;RD_JAVA_S60_RELEASE_10_1_ONWARDS;RD_JAVA_PROXIMITY_LISTENER_ENABLED;RD_JAVA_STDCPPV5;RD_JAVA_ADVANCED_TACTILE_FEEDBACK;__ARMCC__;OPENLCDUI_ENABLED;__SYMBIAN32__;QT_KEYPAD_NAVIGATION;RD_JAVA_OPENC_BETA_PATCH;RD_JAVA_NGA_ENABLED;RD_JAVA_S60_RELEASE_9_2_ONWARDS;__MARM__;QT_USE_MATH_H_FLOATS;__S60_3X__;__ARMCC_2__;__EPOC32__;QT_GUI_LIB;RD_JAVA_MIDPRMS_DB;QT_SOFTKEYS_ENABLED;__S60_50__;" moduleId="configDataCache" sourcesCache="/javam2g_0x2002DCBD/build;/javam2g_0x2002DCBD/inc;/javam2g_0x2002DCBD/src;/javam2g_0x2002DCBD/src/jni;" timestampCache="1278586049270" useMmpMacrosCache="true"/>
-</cconfiguration>
-<cconfiguration id="Phone Debug (ARMV6) [mcl_wk_26]">
-<storageModule buildSystemId="com.nokia.carbide.cdt.builder.CarbideConfigurationDataProvider" id="Phone Debug (ARMV6) [mcl_wk_26]" moduleId="org.eclipse.cdt.core.settings" name="Phone Debug (ARMV6) [mcl_wk_26]">
-<externalSettings/>
-<extensions>
-<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
-<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
-<extension id="com.nokia.cdt.debug.cw.symbian.SymbianE32" point="org.eclipse.cdt.core.BinaryParser"/>
-<extension id="com.nokia.carbide.cdt.builder.MakmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.RVCTLinkerErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.CarbideMakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.SBSv2ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.Elf2E32ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.RCOMPErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.MakeDefErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.RVCTCompilerErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-</extensions>
-</storageModule>
-<storageModule moduleId="CarbideConfigurationDataProvider">
-<ENV_VAR_DATA_ID/>
-<ARGUMENTS_DATA_ID ABLDFREEZEARGSSTORAGE="-r"/>
-<ROM_BUILDER_DATA_ID ROMBUILDWORKINGDIRECTORYSTORAGE="T:\epoc32\rom\"/>
-</storageModule>
-<storageModule filesCache="T:\epoc32\include\platform_paths.hrh;T:\sf\app\jrt\javauis\m2g_qt\build\javam2g_0x2002DCBD.mmp;T:\sf\app\jrt\javauis\m2g_qt\build\bld.inf;" includesCache="T:/sf/app/jrt/javauis/m2g_qt/build[LOCAL];T:/epoc32/include/mw/QtCore;T:/epoc32/include/mw/QtGui;T:/epoc32/include/mw;T:/sf/mw/qt/mkspecs/common/symbian;T:/epoc32/include;T:/epoc32/include/stdapis;T:/epoc32/include/stdapis/sys;T:/epoc32/include/platform/mw;T:/epoc32/include/platform;T:/epoc32/include/platform/loc;T:/epoc32/include/platform/mw/loc;T:/epoc32/include/platform/loc/sc;T:/epoc32/include/platform/mw/loc/sc;T:/epoc32/include/app;T:/epoc32/include/platform/app;T:/epoc32/include/platform/app/loc;T:/epoc32/include/platform/app/loc/sc;T:/epoc32/include/stdapis/openssl;T:/sf/app/jrt/javauis/m2g_qt/inc;T:/sf/app/jrt/javauis/inc;T:/sf/app/jrt/inc;T:/sf/app/jrt/javauis/m2g_qt/src;T:/sf/app/jrt/javauis/m2g_qt/src/jni;T:/sf/app/jrt/javauis/eswt_qt/org.eclipse.ercp.swt.s60/native/inc;T:/sf/app/jrt/javauis/lcdui_qt/lcdgr/inc;T:/sf/app/jrt/javauis/lcdui_qt/javalcdui/inc;T:/sf/app/jrt/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics;T:/epoc32/include/stdapis/stlportv5;T:/sf/app/jrt/javauis/m2g_qt/build;T:/epoc32/build/jrt/javabuild/inc.javah;" macrosCache="QT_CORE_LIB;__DLL__;RD_JAVA_APPLICATION_SETTINGS_QT;RD_JAVA_OPENLCDUI_ENABLED;RD_JAVA_HTTP_EMC_ENABLED;RD_JAVA_UI_QT;__ARMCC_2_2__;SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK;RD_JAVA_S60_RELEASE_5_0_ONWARDS;RD_JAVA_SYMBIAN_TARGET;__SERIES60_3X__;__S60_5X__;__GENERIC_MARM__;__ARMV6__;UNICODE;RD_JAVA_S60_RELEASE_10_1;__EABI__;J9EPOC32;_UNICODE;RD_JAVA_EPOCALLOWDLLDATA_FIX;RD_JAVA_PREWARM;__SUPPORT_CPP_EXCEPTIONS__;RD_JAVA_INSTALLERUI_ENABLED;__MARM_ARMV5__;RD_JAVA_S60_RELEASE_10_1_ONWARDS;RD_JAVA_PROXIMITY_LISTENER_ENABLED;RD_JAVA_STDCPPV5;RD_JAVA_ADVANCED_TACTILE_FEEDBACK;__ARMCC__;OPENLCDUI_ENABLED;__SYMBIAN32__;QT_KEYPAD_NAVIGATION;RD_JAVA_OPENC_BETA_PATCH;RD_JAVA_NGA_ENABLED;RD_JAVA_S60_RELEASE_9_2_ONWARDS;__MARM__;QT_USE_MATH_H_FLOATS;__S60_3X__;__ARMCC_2__;__EPOC32__;QT_GUI_LIB;RD_JAVA_MIDPRMS_DB;QT_SOFTKEYS_ENABLED;_DEBUG;__S60_50__;" moduleId="configDataCache" sourcesCache="/javam2g_0x2002DCBD/build;/javam2g_0x2002DCBD/inc;/javam2g_0x2002DCBD/src;/javam2g_0x2002DCBD/src/jni;" timestampCache="1278586049864" useMmpMacrosCache="true"/>
-</cconfiguration>
-<cconfiguration id="Phone Release (ARMV6) [mcl_wk_26]">
-<storageModule buildSystemId="com.nokia.carbide.cdt.builder.CarbideConfigurationDataProvider" id="Phone Release (ARMV6) [mcl_wk_26]" moduleId="org.eclipse.cdt.core.settings" name="Phone Release (ARMV6) [mcl_wk_26]">
-<externalSettings/>
-<extensions>
-<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
-<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
-<extension id="com.nokia.cdt.debug.cw.symbian.SymbianE32" point="org.eclipse.cdt.core.BinaryParser"/>
-<extension id="com.nokia.carbide.cdt.builder.MakmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.RVCTLinkerErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.CarbideMakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.SBSv2ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.Elf2E32ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.RCOMPErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.MakeDefErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.RVCTCompilerErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-</extensions>
-</storageModule>
-<storageModule moduleId="CarbideConfigurationDataProvider">
-<ENV_VAR_DATA_ID/>
-<ARGUMENTS_DATA_ID ABLDFREEZEARGSSTORAGE="-r"/>
-<ROM_BUILDER_DATA_ID ROMBUILDWORKINGDIRECTORYSTORAGE="T:\epoc32\rom\"/>
-</storageModule>
-<storageModule filesCache="T:\epoc32\include\platform_paths.hrh;T:\sf\app\jrt\javauis\m2g_qt\build\javam2g_0x2002DCBD.mmp;T:\sf\app\jrt\javauis\m2g_qt\build\bld.inf;" includesCache="T:/sf/app/jrt/javauis/m2g_qt/build[LOCAL];T:/epoc32/include/mw/QtCore;T:/epoc32/include/mw/QtGui;T:/epoc32/include/mw;T:/sf/mw/qt/mkspecs/common/symbian;T:/epoc32/include;T:/epoc32/include/stdapis;T:/epoc32/include/stdapis/sys;T:/epoc32/include/platform/mw;T:/epoc32/include/platform;T:/epoc32/include/platform/loc;T:/epoc32/include/platform/mw/loc;T:/epoc32/include/platform/loc/sc;T:/epoc32/include/platform/mw/loc/sc;T:/epoc32/include/app;T:/epoc32/include/platform/app;T:/epoc32/include/platform/app/loc;T:/epoc32/include/platform/app/loc/sc;T:/epoc32/include/stdapis/openssl;T:/sf/app/jrt/javauis/m2g_qt/inc;T:/sf/app/jrt/javauis/inc;T:/sf/app/jrt/inc;T:/sf/app/jrt/javauis/m2g_qt/src;T:/sf/app/jrt/javauis/m2g_qt/src/jni;T:/sf/app/jrt/javauis/eswt_qt/org.eclipse.ercp.swt.s60/native/inc;T:/sf/app/jrt/javauis/lcdui_qt/lcdgr/inc;T:/sf/app/jrt/javauis/lcdui_qt/javalcdui/inc;T:/sf/app/jrt/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics;T:/epoc32/include/stdapis/stlportv5;T:/sf/app/jrt/javauis/m2g_qt/build;T:/epoc32/build/jrt/javabuild/inc.javah;" macrosCache="QT_CORE_LIB;__DLL__;RD_JAVA_APPLICATION_SETTINGS_QT;RD_JAVA_OPENLCDUI_ENABLED;NDEBUG;RD_JAVA_HTTP_EMC_ENABLED;RD_JAVA_UI_QT;__ARMCC_2_2__;SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK;RD_JAVA_S60_RELEASE_5_0_ONWARDS;RD_JAVA_SYMBIAN_TARGET;__SERIES60_3X__;__S60_5X__;__GENERIC_MARM__;__ARMV6__;UNICODE;RD_JAVA_S60_RELEASE_10_1;__EABI__;J9EPOC32;_UNICODE;RD_JAVA_EPOCALLOWDLLDATA_FIX;RD_JAVA_PREWARM;__SUPPORT_CPP_EXCEPTIONS__;RD_JAVA_INSTALLERUI_ENABLED;__MARM_ARMV5__;RD_JAVA_S60_RELEASE_10_1_ONWARDS;RD_JAVA_PROXIMITY_LISTENER_ENABLED;RD_JAVA_STDCPPV5;RD_JAVA_ADVANCED_TACTILE_FEEDBACK;__ARMCC__;OPENLCDUI_ENABLED;__SYMBIAN32__;QT_KEYPAD_NAVIGATION;RD_JAVA_OPENC_BETA_PATCH;RD_JAVA_NGA_ENABLED;RD_JAVA_S60_RELEASE_9_2_ONWARDS;__MARM__;QT_USE_MATH_H_FLOATS;__S60_3X__;__ARMCC_2__;__EPOC32__;QT_GUI_LIB;RD_JAVA_MIDPRMS_DB;QT_SOFTKEYS_ENABLED;__S60_50__;" moduleId="configDataCache" sourcesCache="/javam2g_0x2002DCBD/build;/javam2g_0x2002DCBD/inc;/javam2g_0x2002DCBD/src;/javam2g_0x2002DCBD/src/jni;" timestampCache="1278586050380" useMmpMacrosCache="true"/>
-</cconfiguration>
-<cconfiguration id="Phone Debug (ARMV7) [mcl_wk_26]">
-<storageModule buildSystemId="com.nokia.carbide.cdt.builder.CarbideConfigurationDataProvider" id="Phone Debug (ARMV7) [mcl_wk_26]" moduleId="org.eclipse.cdt.core.settings" name="Phone Debug (ARMV7) [mcl_wk_26]">
-<externalSettings/>
-<extensions>
-<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
-<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
-<extension id="com.nokia.cdt.debug.cw.symbian.SymbianE32" point="org.eclipse.cdt.core.BinaryParser"/>
-<extension id="com.nokia.carbide.cdt.builder.MakmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.RVCTLinkerErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.CarbideMakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.SBSv2ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.Elf2E32ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.RCOMPErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.MakeDefErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.RVCTCompilerErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-</extensions>
-</storageModule>
-<storageModule moduleId="CarbideConfigurationDataProvider">
-<ENV_VAR_DATA_ID/>
-<ARGUMENTS_DATA_ID ABLDFREEZEARGSSTORAGE="-r"/>
-<ROM_BUILDER_DATA_ID ROMBUILDWORKINGDIRECTORYSTORAGE="T:\epoc32\rom\"/>
-</storageModule>
-<storageModule filesCache="T:\epoc32\include\platform_paths.hrh;T:\sf\app\jrt\javauis\m2g_qt\build\javam2g_0x2002DCBD.mmp;T:\sf\app\jrt\javauis\m2g_qt\build\bld.inf;" includesCache="T:/sf/app/jrt/javauis/m2g_qt/build[LOCAL];T:/epoc32/include/mw/QtCore;T:/epoc32/include/mw/QtGui;T:/epoc32/include/mw;T:/sf/mw/qt/mkspecs/common/symbian;T:/epoc32/include;T:/epoc32/include/stdapis;T:/epoc32/include/stdapis/sys;T:/epoc32/include/platform/mw;T:/epoc32/include/platform;T:/epoc32/include/platform/loc;T:/epoc32/include/platform/mw/loc;T:/epoc32/include/platform/loc/sc;T:/epoc32/include/platform/mw/loc/sc;T:/epoc32/include/app;T:/epoc32/include/platform/app;T:/epoc32/include/platform/app/loc;T:/epoc32/include/platform/app/loc/sc;T:/epoc32/include/stdapis/openssl;T:/sf/app/jrt/javauis/m2g_qt/inc;T:/sf/app/jrt/javauis/inc;T:/sf/app/jrt/inc;T:/sf/app/jrt/javauis/m2g_qt/src;T:/sf/app/jrt/javauis/m2g_qt/src/jni;T:/sf/app/jrt/javauis/eswt_qt/org.eclipse.ercp.swt.s60/native/inc;T:/sf/app/jrt/javauis/lcdui_qt/lcdgr/inc;T:/sf/app/jrt/javauis/lcdui_qt/javalcdui/inc;T:/sf/app/jrt/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics;T:/epoc32/include/stdapis/stlportv5;T:/sf/app/jrt/javauis/m2g_qt/build;T:/epoc32/build/jrt/javabuild/inc.javah;" macrosCache="QT_CORE_LIB;__DLL__;__ARMV7__;RD_JAVA_APPLICATION_SETTINGS_QT;RD_JAVA_OPENLCDUI_ENABLED;RD_JAVA_HTTP_EMC_ENABLED;RD_JAVA_UI_QT;__ARMCC_2_2__;SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK;RD_JAVA_S60_RELEASE_5_0_ONWARDS;RD_JAVA_SYMBIAN_TARGET;__SERIES60_3X__;__S60_5X__;__GENERIC_MARM__;UNICODE;RD_JAVA_S60_RELEASE_10_1;__EABI__;J9EPOC32;_UNICODE;RD_JAVA_EPOCALLOWDLLDATA_FIX;RD_JAVA_PREWARM;__SUPPORT_CPP_EXCEPTIONS__;RD_JAVA_INSTALLERUI_ENABLED;__MARM_ARMV5__;RD_JAVA_S60_RELEASE_10_1_ONWARDS;RD_JAVA_PROXIMITY_LISTENER_ENABLED;RD_JAVA_STDCPPV5;RD_JAVA_ADVANCED_TACTILE_FEEDBACK;__ARMCC__;OPENLCDUI_ENABLED;__SYMBIAN32__;QT_KEYPAD_NAVIGATION;RD_JAVA_OPENC_BETA_PATCH;RD_JAVA_NGA_ENABLED;RD_JAVA_S60_RELEASE_9_2_ONWARDS;__MARM__;QT_USE_MATH_H_FLOATS;__S60_3X__;__ARMCC_2__;__EPOC32__;QT_GUI_LIB;RD_JAVA_MIDPRMS_DB;QT_SOFTKEYS_ENABLED;_DEBUG;__S60_50__;" moduleId="configDataCache" sourcesCache="/javam2g_0x2002DCBD/build;/javam2g_0x2002DCBD/inc;/javam2g_0x2002DCBD/src;/javam2g_0x2002DCBD/src/jni;" timestampCache="1278586051427" useMmpMacrosCache="true"/>
-</cconfiguration>
-<cconfiguration id="Phone Release (ARMV7) [mcl_wk_26]">
-<storageModule buildSystemId="com.nokia.carbide.cdt.builder.CarbideConfigurationDataProvider" id="Phone Release (ARMV7) [mcl_wk_26]" moduleId="org.eclipse.cdt.core.settings" name="Phone Release (ARMV7) [mcl_wk_26]">
-<externalSettings/>
-<extensions>
-<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
-<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
-<extension id="com.nokia.cdt.debug.cw.symbian.SymbianE32" point="org.eclipse.cdt.core.BinaryParser"/>
-<extension id="com.nokia.carbide.cdt.builder.MakmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.RVCTLinkerErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.CarbideMakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.SBSv2ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.Elf2E32ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.RCOMPErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.MakeDefErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.RVCTCompilerErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-</extensions>
-</storageModule>
-<storageModule moduleId="CarbideConfigurationDataProvider">
-<ENV_VAR_DATA_ID/>
-<ARGUMENTS_DATA_ID ABLDFREEZEARGSSTORAGE="-r"/>
-<ROM_BUILDER_DATA_ID ROMBUILDWORKINGDIRECTORYSTORAGE="T:\epoc32\rom\"/>
-</storageModule>
-<storageModule filesCache="T:\epoc32\include\platform_paths.hrh;T:\sf\app\jrt\javauis\m2g_qt\build\javam2g_0x2002DCBD.mmp;T:\sf\app\jrt\javauis\m2g_qt\build\bld.inf;" includesCache="T:/sf/app/jrt/javauis/m2g_qt/build[LOCAL];T:/epoc32/include/mw/QtCore;T:/epoc32/include/mw/QtGui;T:/epoc32/include/mw;T:/sf/mw/qt/mkspecs/common/symbian;T:/epoc32/include;T:/epoc32/include/stdapis;T:/epoc32/include/stdapis/sys;T:/epoc32/include/platform/mw;T:/epoc32/include/platform;T:/epoc32/include/platform/loc;T:/epoc32/include/platform/mw/loc;T:/epoc32/include/platform/loc/sc;T:/epoc32/include/platform/mw/loc/sc;T:/epoc32/include/app;T:/epoc32/include/platform/app;T:/epoc32/include/platform/app/loc;T:/epoc32/include/platform/app/loc/sc;T:/epoc32/include/stdapis/openssl;T:/sf/app/jrt/javauis/m2g_qt/inc;T:/sf/app/jrt/javauis/inc;T:/sf/app/jrt/inc;T:/sf/app/jrt/javauis/m2g_qt/src;T:/sf/app/jrt/javauis/m2g_qt/src/jni;T:/sf/app/jrt/javauis/eswt_qt/org.eclipse.ercp.swt.s60/native/inc;T:/sf/app/jrt/javauis/lcdui_qt/lcdgr/inc;T:/sf/app/jrt/javauis/lcdui_qt/javalcdui/inc;T:/sf/app/jrt/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics;T:/epoc32/include/stdapis/stlportv5;T:/sf/app/jrt/javauis/m2g_qt/build;T:/epoc32/build/jrt/javabuild/inc.javah;" macrosCache="QT_CORE_LIB;__DLL__;__ARMV7__;RD_JAVA_APPLICATION_SETTINGS_QT;RD_JAVA_OPENLCDUI_ENABLED;NDEBUG;RD_JAVA_HTTP_EMC_ENABLED;RD_JAVA_UI_QT;__ARMCC_2_2__;SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK;RD_JAVA_S60_RELEASE_5_0_ONWARDS;RD_JAVA_SYMBIAN_TARGET;__SERIES60_3X__;__S60_5X__;__GENERIC_MARM__;UNICODE;RD_JAVA_S60_RELEASE_10_1;__EABI__;J9EPOC32;_UNICODE;RD_JAVA_EPOCALLOWDLLDATA_FIX;RD_JAVA_PREWARM;__SUPPORT_CPP_EXCEPTIONS__;RD_JAVA_INSTALLERUI_ENABLED;__MARM_ARMV5__;RD_JAVA_S60_RELEASE_10_1_ONWARDS;RD_JAVA_PROXIMITY_LISTENER_ENABLED;RD_JAVA_STDCPPV5;RD_JAVA_ADVANCED_TACTILE_FEEDBACK;__ARMCC__;OPENLCDUI_ENABLED;__SYMBIAN32__;QT_KEYPAD_NAVIGATION;RD_JAVA_OPENC_BETA_PATCH;RD_JAVA_NGA_ENABLED;RD_JAVA_S60_RELEASE_9_2_ONWARDS;__MARM__;QT_USE_MATH_H_FLOATS;__S60_3X__;__ARMCC_2__;__EPOC32__;QT_GUI_LIB;RD_JAVA_MIDPRMS_DB;QT_SOFTKEYS_ENABLED;__S60_50__;" moduleId="configDataCache" sourcesCache="/javam2g_0x2002DCBD/build;/javam2g_0x2002DCBD/inc;/javam2g_0x2002DCBD/src;/javam2g_0x2002DCBD/src/jni;" timestampCache="1278586051833" useMmpMacrosCache="true"/>
-</cconfiguration>
-<cconfiguration id="Phone Debug (ARMV9E) [mcl_wk_26]">
-<storageModule buildSystemId="com.nokia.carbide.cdt.builder.CarbideConfigurationDataProvider" id="Phone Debug (ARMV9E) [mcl_wk_26]" moduleId="org.eclipse.cdt.core.settings" name="Phone Debug (ARMV9E) [mcl_wk_26]">
-<externalSettings/>
-<extensions>
-<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
-<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
-<extension id="com.nokia.cdt.debug.cw.symbian.SymbianE32" point="org.eclipse.cdt.core.BinaryParser"/>
-<extension id="com.nokia.carbide.cdt.builder.MakmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.RVCTLinkerErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.CarbideMakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.SBSv2ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.Elf2E32ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.RCOMPErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.MakeDefErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.RVCTCompilerErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-</extensions>
-</storageModule>
-<storageModule moduleId="CarbideConfigurationDataProvider">
-<ENV_VAR_DATA_ID/>
-<ARGUMENTS_DATA_ID ABLDFREEZEARGSSTORAGE="-r"/>
-<ROM_BUILDER_DATA_ID ROMBUILDWORKINGDIRECTORYSTORAGE="T:\epoc32\rom\"/>
-</storageModule>
-<storageModule filesCache="T:\epoc32\include\platform_paths.hrh;T:\sf\app\jrt\javauis\m2g_qt\build\javam2g_0x2002DCBD.mmp;T:\sf\app\jrt\javauis\m2g_qt\build\bld.inf;" includesCache="T:/sf/app/jrt/javauis/m2g_qt/build[LOCAL];T:/epoc32/include/mw/QtCore;T:/epoc32/include/mw/QtGui;T:/epoc32/include/mw;T:/sf/mw/qt/mkspecs/common/symbian;T:/epoc32/include;T:/epoc32/include/stdapis;T:/epoc32/include/stdapis/sys;T:/epoc32/include/platform/mw;T:/epoc32/include/platform;T:/epoc32/include/platform/loc;T:/epoc32/include/platform/mw/loc;T:/epoc32/include/platform/loc/sc;T:/epoc32/include/platform/mw/loc/sc;T:/epoc32/include/app;T:/epoc32/include/platform/app;T:/epoc32/include/platform/app/loc;T:/epoc32/include/platform/app/loc/sc;T:/epoc32/include/stdapis/openssl;T:/sf/app/jrt/javauis/m2g_qt/inc;T:/sf/app/jrt/javauis/inc;T:/sf/app/jrt/inc;T:/sf/app/jrt/javauis/m2g_qt/src;T:/sf/app/jrt/javauis/m2g_qt/src/jni;T:/sf/app/jrt/javauis/eswt_qt/org.eclipse.ercp.swt.s60/native/inc;T:/sf/app/jrt/javauis/lcdui_qt/lcdgr/inc;T:/sf/app/jrt/javauis/lcdui_qt/javalcdui/inc;T:/sf/app/jrt/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics;T:/epoc32/include/stdapis/stlportv5;T:/sf/app/jrt/javauis/m2g_qt/build;T:/epoc32/build/jrt/javabuild/inc.javah;" macrosCache="QT_CORE_LIB;__DLL__;RD_JAVA_APPLICATION_SETTINGS_QT;RD_JAVA_OPENLCDUI_ENABLED;RD_JAVA_HTTP_EMC_ENABLED;RD_JAVA_UI_QT;RD_JAVA_S60_RELEASE_5_0_ONWARDS;SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK;RD_JAVA_SYMBIAN_TARGET;__SERIES60_3X__;__S60_5X__;UNICODE;RD_JAVA_S60_RELEASE_10_1;J9EPOC32;_UNICODE;RD_JAVA_EPOCALLOWDLLDATA_FIX;RD_JAVA_PREWARM;__SUPPORT_CPP_EXCEPTIONS__;RD_JAVA_INSTALLERUI_ENABLED;RD_JAVA_S60_RELEASE_10_1_ONWARDS;RD_JAVA_STDCPPV5;RD_JAVA_PROXIMITY_LISTENER_ENABLED;RD_JAVA_ADVANCED_TACTILE_FEEDBACK;OPENLCDUI_ENABLED;__SYMBIAN32__;QT_KEYPAD_NAVIGATION;RD_JAVA_OPENC_BETA_PATCH;RD_JAVA_S60_RELEASE_9_2_ONWARDS;RD_JAVA_NGA_ENABLED;QT_USE_MATH_H_FLOATS;__S60_3X__;QT_GUI_LIB;RD_JAVA_MIDPRMS_DB;QT_SOFTKEYS_ENABLED;__S60_50__;_DEBUG;" moduleId="configDataCache" sourcesCache="/javam2g_0x2002DCBD/build;/javam2g_0x2002DCBD/inc;/javam2g_0x2002DCBD/src;/javam2g_0x2002DCBD/src/jni;" timestampCache="1278586052239" useMmpMacrosCache="true"/>
-</cconfiguration>
-<cconfiguration id="Phone Release (ARMV9E) [mcl_wk_26]">
-<storageModule buildSystemId="com.nokia.carbide.cdt.builder.CarbideConfigurationDataProvider" id="Phone Release (ARMV9E) [mcl_wk_26]" moduleId="org.eclipse.cdt.core.settings" name="Phone Release (ARMV9E) [mcl_wk_26]">
-<externalSettings/>
-<extensions>
-<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
-<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
-<extension id="com.nokia.cdt.debug.cw.symbian.SymbianE32" point="org.eclipse.cdt.core.BinaryParser"/>
-<extension id="com.nokia.carbide.cdt.builder.MakmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.RVCTLinkerErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.CarbideMakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.SBSv2ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.Elf2E32ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.RCOMPErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.MakeDefErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.RVCTCompilerErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-</extensions>
-</storageModule>
-<storageModule moduleId="CarbideConfigurationDataProvider">
-<ENV_VAR_DATA_ID/>
-<ARGUMENTS_DATA_ID ABLDFREEZEARGSSTORAGE="-r"/>
-<ROM_BUILDER_DATA_ID ROMBUILDWORKINGDIRECTORYSTORAGE="T:\epoc32\rom\"/>
-</storageModule>
-<storageModule filesCache="T:\epoc32\include\platform_paths.hrh;T:\sf\app\jrt\javauis\m2g_qt\build\javam2g_0x2002DCBD.mmp;T:\sf\app\jrt\javauis\m2g_qt\build\bld.inf;" includesCache="T:/sf/app/jrt/javauis/m2g_qt/build[LOCAL];T:/epoc32/include/mw/QtCore;T:/epoc32/include/mw/QtGui;T:/epoc32/include/mw;T:/sf/mw/qt/mkspecs/common/symbian;T:/epoc32/include;T:/epoc32/include/stdapis;T:/epoc32/include/stdapis/sys;T:/epoc32/include/platform/mw;T:/epoc32/include/platform;T:/epoc32/include/platform/loc;T:/epoc32/include/platform/mw/loc;T:/epoc32/include/platform/loc/sc;T:/epoc32/include/platform/mw/loc/sc;T:/epoc32/include/app;T:/epoc32/include/platform/app;T:/epoc32/include/platform/app/loc;T:/epoc32/include/platform/app/loc/sc;T:/epoc32/include/stdapis/openssl;T:/sf/app/jrt/javauis/m2g_qt/inc;T:/sf/app/jrt/javauis/inc;T:/sf/app/jrt/inc;T:/sf/app/jrt/javauis/m2g_qt/src;T:/sf/app/jrt/javauis/m2g_qt/src/jni;T:/sf/app/jrt/javauis/eswt_qt/org.eclipse.ercp.swt.s60/native/inc;T:/sf/app/jrt/javauis/lcdui_qt/lcdgr/inc;T:/sf/app/jrt/javauis/lcdui_qt/javalcdui/inc;T:/sf/app/jrt/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics;T:/epoc32/include/stdapis/stlportv5;T:/sf/app/jrt/javauis/m2g_qt/build;T:/epoc32/build/jrt/javabuild/inc.javah;" macrosCache="QT_CORE_LIB;__DLL__;RD_JAVA_APPLICATION_SETTINGS_QT;RD_JAVA_OPENLCDUI_ENABLED;NDEBUG;RD_JAVA_HTTP_EMC_ENABLED;RD_JAVA_UI_QT;RD_JAVA_S60_RELEASE_5_0_ONWARDS;SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK;RD_JAVA_SYMBIAN_TARGET;__SERIES60_3X__;__S60_5X__;UNICODE;RD_JAVA_S60_RELEASE_10_1;J9EPOC32;_UNICODE;RD_JAVA_EPOCALLOWDLLDATA_FIX;RD_JAVA_PREWARM;__SUPPORT_CPP_EXCEPTIONS__;RD_JAVA_INSTALLERUI_ENABLED;RD_JAVA_S60_RELEASE_10_1_ONWARDS;RD_JAVA_STDCPPV5;RD_JAVA_PROXIMITY_LISTENER_ENABLED;RD_JAVA_ADVANCED_TACTILE_FEEDBACK;OPENLCDUI_ENABLED;__SYMBIAN32__;QT_KEYPAD_NAVIGATION;RD_JAVA_OPENC_BETA_PATCH;RD_JAVA_S60_RELEASE_9_2_ONWARDS;RD_JAVA_NGA_ENABLED;QT_USE_MATH_H_FLOATS;__S60_3X__;QT_GUI_LIB;RD_JAVA_MIDPRMS_DB;QT_SOFTKEYS_ENABLED;__S60_50__;" moduleId="configDataCache" sourcesCache="/javam2g_0x2002DCBD/build;/javam2g_0x2002DCBD/inc;/javam2g_0x2002DCBD/src;/javam2g_0x2002DCBD/src/jni;" timestampCache="1278586052645" useMmpMacrosCache="true"/>
-</cconfiguration>
-</storageModule>
-</cproject>
--- a/javauis/m2g_qt/.project Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>javam2g_0x2002DCBD</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>com.nokia.carbide.cdt.builder.carbideCPPBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.cdt.core.cnature</nature>
- <nature>org.eclipse.cdt.core.ccnature</nature>
- <nature>com.nokia.carbide.cdt.builder.carbideCPPBuilderNature</nature>
- <nature>com.nokia.carbide.cdt.builder.carbideSBSv2BuilderNature</nature>
- </natures>
-</projectDescription>
--- a/javauis/m2g_qt/build/build.xml Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-<!--
-#
-# Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
--->
-
-<project name="javam2g" default="deploy" basedir=".">
-
- <import file="../../../build/utilities.xml"/>
-
- <!-- Needed by the utilities.xml. See the description form the utilities.xml
- file -->
-
- <target name="compile">
- <omj.javac classpath="${classpath}:${impl.cldc.jar}"/>
- </target>
-
-
- <!-- Needed by the utilities.xml. See the description form the utilities.xml
- file -->
-
- <property name="javah.classnames"
- value="com.nokia.microedition.m2g.M2GDocument,
- com.nokia.microedition.m2g.M2GSVGPath,
- com.nokia.microedition.m2g.M2GSVGSVGElement,
- com.nokia.microedition.m2g.M2GManager,
- com.nokia.microedition.m2g.M2GScalableGraphics,
- com.nokia.microedition.m2g.M2GSVGAnimationElement,
- com.nokia.microedition.m2g.M2GSVGElement,
- com.nokia.microedition.m2g.M2GSVGImage,
- com.nokia.microedition.m2g.M2GRunnableQt"/>
-
- <target name="system.properties">
- <properties>
- microedition.m2g.svg.baseProfile=tiny
- microedition.m2g.svg.version=1.1
- microedition.m2g.version=1.1
- </properties>
- </target>
-
- <target name="create.public.api.jar">
- <omj.public.apis includes="javax/microedition/m2g/ExternalResourceHandler.class,
- javax/microedition/m2g/ScalableGraphics.class,
- javax/microedition/m2g/ScalableImage.class,
- javax/microedition/m2g/SVGAnimator.class,
- javax/microedition/m2g/SVGEventListener.class,
- javax/microedition/m2g/SVGImage.class"/>
- </target>
-
-
-</project>
-
--- a/javauis/m2g_qt/build/bwins/javam2gu.def Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-EXPORTS
- ?jni_lookup@@YAP6AXXZPBD@Z @ 1 NONAME ; void (*)(void) jni_lookup(char const *)
-
--- a/javauis/m2g_qt/build/javam2g.pro Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
-
-TEMPLATE=lib
-TARGET=javam2g
-CONFIG += omj java stl
-#CONFIG -= qt
-
-SOURCES += ../src/*.cpp
-SOURCES += ../src/jni/*.cpp
-
-LIBS += -lavkon \
- -lbitgdi \
- -lcharconv \
- -lcone \
- -leikcore \
- -eswtqt \
- -lfbscli \
- -lgdi \
- -ljavalegacyutils \
- -lSVGEngineJI \
- -lopenlcdui \
- -lefsrv \
- -lfbscli \
- -limageconversion
-
-include(../../../build/omj.pri )
-
-INCLUDEPATH += ../../eswt_qt/org.eclipse.ercp.swt.s60/native/inc/
-INCLUDEPATH += ../../lcdui_qt/lcdgr/inc/
-INCLUDEPATH += ../../lcdui_qt/javalcdui/inc/
-INCLUDEPATH += ../../eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/graphics.h
-
--- a/javauis/m2g_qt/inc/CM2GEventSource.h Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-/*
-* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Event server framework's event source implementation
-*
-*/
-
-#ifndef CM2GEVENTSOURCE_H
-#define CM2GEVENTSOURCE_H
-
-// INCLUDE FILES
-#include <mevents.h> // CJavaEventSource, TConstructor
-#include "M2GGeneral.h"
-
-M2G_NS_START
-// CONSTANTS
-
-// DATA TYPES
-
-// MACROS
-
-// FORWARD DECLARATIONS
-
-// FUNCTION PROTOTYPES
-
-// CLASS DECLARATION
-/**
- * @class CJavaM3GEventSource
- * @brief Event source
- */
-class CM2GEventSource : public CJavaEventSource<CM2GEventSource>
-{
-public:
- /**
- * Two-phased constructor.
- * @since Series S60 3.1
- * @param aJni JNI environment
- * @param aPeer Peer object
- * @param aServer Server
- * @return Event source handle
- */
- static TInt NewL(JNIEnv& aJni, jobject aPeer, TJavaEventServer aServer);
-
- /**
- * Dtor
- * @since Series S60 3.1
- */
- virtual ~CM2GEventSource();
-
-private:
- /**
- * Ctor
- * @since Series S60 3.1
- */
- CM2GEventSource();
-
- /**
- * Constructor
- * @since Series S60 3.1
- * @param aJni JNI environment
- * @param aPeer Peer object
- * @param aServer Server
- */
- void ConstructL(JNIEnv& aJni, jobject aPeer, TJavaEventServer aServer);
-
- /**
- * C++ copy constructor
- * @since Series S60 3.1
- */
- CM2GEventSource(const CM2GEventSource&);
-
- /**
- * C++ assignment operator
- * @since Series S60 3.1
- */
- CM2GEventSource& operator=(const CM2GEventSource&);
-
-};
-
-M2G_NS_END
-
-#endif // CM2GEVENTSOURCE_H
--- a/javauis/m2g_qt/inc/CM2GRenderContext.h Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,252 +0,0 @@
-/*
-* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Render context
-*
-*/
-
-#ifndef CM2GRENDERCONTEXT_H
-#define CM2GRENDERCONTEXT_H
-
-// INCLUDES
-#include <fbs.h>
-#include "MM2GRenderContext.h"
-#include <graphics.h>
-
-class CSvgtBitmap;
-
-M2G_NS_START
-
-// CONSTANTS
-
-// MACROS
-
-// DATA TYPES
-
-// FUNCTION PROTOTYPES
-
-// FORWARD DECLARATIONS
-class MM2GSVGProxy;
-class CBitmapContext;
-#ifdef RD_JAVA_NGA_ENABLED
-class MMIDCanvas;
-#endif // RD_JAVA_NGA_ENABLED
-
-// CLASS DECLARATION
-/**
- * Render context
- */
-
-
-class CM2GRenderContext : public CBase, public MM2GRenderContext
-{
-private: // METHODS
- /**
- * C++ default constructor.
- */
- CM2GRenderContext();
-
- /**
- * C++ copy constructor
- */
- CM2GRenderContext(const CM2GRenderContext&);
-
- /**
- * C++ assignment operator
- */
- CM2GRenderContext& operator=(const CM2GRenderContext&);
-
- /**
- * Initialization
- */
- void ConstructL(MM2GSVGProxy* aProxy);
-
-public: // METHODS
- /**
- * Two-phased constructor.
- */
- static CM2GRenderContext* NewL(MM2GSVGProxy* aProxy);
-
- /**
- * Destructor.
- */
- virtual ~CM2GRenderContext();
-
- /**
- * @see MM2GRenderContext::BindL()
- */
- virtual void BindL(TInt& aGraphicsHandle);
-
- /**
- * @see MM2GRenderContext::InitImageBitmapL()
- */
- virtual void InitImageBitmapL();
-
- /**
- * @see MM2GRenderContext::BlitToL()
- */
- virtual void ReleaseL();
-
- /**
- * @see MM2GRenderContext::RenderL()
- */
- virtual void RenderLCDUIL(
- TM2GSvgDocumentHandle& aSvgDocumentHandle,
- const TReal32 aCurrentTime,
- TInt aSvgW, TInt aSvgH,
- TM2GRenderRect& aRect);
- virtual void RenderESWTL(
- TM2GSvgDocumentHandle& aSvgDocHandle,
- const TReal32 aCurrentTime,
- TInt aSvgW, TInt aSvgH,
- TM2GRenderRect& aRect,
- TBool aUseNativeClear,
- TInt* aReturnData);
-
- /**
- * @see MM2GRenderContext::SetRenderingQualityL()
- */
- virtual void SetRenderingQualityL(TInt aMode);
-
- /**
- * @see MM2GRenderContext::SetTransparency()
- */
- virtual void SetTransparency(TReal32 aAlpha);
-
-
- TInt SaveBitmapL(const CFbsBitmap& aNVGBitmap, const TFileName& aFileName);
-protected: // METHODS
- /**
- * Get the image's bitmap handle
- *
- * @return Svg surface handle.
- * @throws Exception if not ok.
- */
- TM2GBitmapHandle GetImgHandleL() const;
-
-private:
- /**
- * Prepare viewbox and anchor
- *
- * @param aRr clip area information
- * @return aViewbox render rectangle area
- * @return aAnchor recalculated anchor point
- */
- void PrepareViewbox(
- TM2GRenderRect& aRr,
- TInt aSvgW, TInt aSvgH,
- TRect& aViewbox, TPoint& aAnchor);
-
- /**
- * Renders a SVG document at a current time.
- *
- * <p> The rendering is done in 2 steps:
- * <li> render the document on an internal SVG buffer (iSvg)
- * <li> alpha-blend it with the bound graphics target (iGraphicsBitmap)
- *
- * @note if transparency factor is not set, iSvg is simply blitted onto iGraphicsTarget
- *
- * @param aSvgDocumentHandle handle to SVG document
- * @param aCurrentTime the current time of the animation
- * @param aSvgW Svg image viewport width
- * @param aSvgH Svg image viewport height
- * @param aRect contains position about the rendered area
- * @param aAnchor anchor point
- *
- * @since S60 3.1
- */
- void RenderLCDUIL(
- TM2GSvgDocumentHandle& aSvgDocumentHandle,
- const TReal32 aCurrentTime,
- const TRect& aViewbox,
- const TPoint& aAnchor);
-
- void RenderESWTL(
- TM2GSvgDocumentHandle& aSvgDocHandle,
- TReal32 aCurrentTime,
- const TRect& aViewbox,
- const TPoint& aAnchor,
- TBool aUseNativeClear,
- TInt* aReturnData);
-
- /**
- * Clear the bitmap with 0
- * Fills all pixel with 0 value
- *
- * @param aBmp the bitmap to be filled
- */
- void CM2GRenderContext::ClearBitmapL(CFbsBitmap* aBmp);
-
- /**
- * Fills all the pixels of a bitmap with a specific byte
- *
- * @param aBmp the bitmap to be filled
- * @param aChar the character(byte) to fill with
- */
- void FillBitmapL(CFbsBitmap* aBmp, const TUint8& aChar);
-
-
-private: // VARIABLES
-
- //For WindowsSurface CFbsBitmap || Qimage
- Java::GFX::WindowSurface* iWindowSurface;
-
-
- MM2GSVGProxy* iProxy;
-
- TM2GSvgEngineHandle iEngineHandle;
-
- TReal32 iAlpha;
- TUint8 iScaledAlpha;
-
-//for eswt compatibility
- CFbsBitmap* iImgBmp;
- RFbsSession iFbsSession;
-
-
-// Temporary buffer ( offscreen ) for QImage support
- QImage* iOffScreenQImage;
- CFbsBitmap* iOffScreenBitmap;
-
- QImage* iTargetQImage;
-
- Java::GFX::WindowSurfaceType wSurfaceType;
- CSvgtBitmap * targetBitmap;
-
- CFbsBitmap* tempBitmapForMask ;
-
-protected:
- TM2GSvgBitmapHandle GetBufferHandleL() const;
- void InitializeQImageOffscreenBufferL(TSize aScreenSize,QImage* aQimage);
- void InitializeCFbsBitmapOffscreenBufferL(TSize aScreenSize,CFbsBitmap* aBitmap);
- void ClearSurfaceL(TM2GSvgBitmapHandle aSvgtBmpHandle);
-private:
-
-};
-/*-----------------------------------------------------------
-class : CFbsBitmapHack
-purpose: Class is provided as a solution for double render
- issue in eSWT
-*-----------------------------------------------------------*/
-class CFbsBitmapHack : public CFbsBitmap
-{
-public:
- TInt GetMyHandle()
- {
- return iHandle;
- }
-};
-
-
-M2G_NS_END
-#endif // CM2GRENDERCONTEXT_H
--- a/javauis/m2g_qt/inc/CM2GSVGProxy.h Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,585 +0,0 @@
-/*
-* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: SVGTopt proxy
-*
-*/
-
-#ifndef CM2GSVGPROXY_H
-#define CM2GSVGPROXY_H
-
-// INCLUDES
-#include "MM2GSVGProxy.h"
-
-M2G_NS_START
-
-// CONSTANTS
-
-// MACROS
-
-// DATA TYPES
-
-// FUNCTION PROTOTYPES
-
-// FORWARD DECLARATIONS
-class CSvgJavaInterfaceImpl;
-
-// CLASS DECLARATION
-/**
- *
- */
-class CM2GSVGProxy : public CBase, public MM2GSVGProxy
-{
-public: // METHODS
- /**
- * Two-phased constructor.
- * @return Reference counted proxy wrapper
- */
- static CM2GSVGProxy* NewL();
-
- /**
- * Destructor.
- */
- virtual ~CM2GSVGProxy();
-
- /**
- * @see MM2GSVGProxy::AddCloseL
- */
- virtual void AddCloseL(const TM2GSvgPathHandle& aPathHandle);
-
- /**
- * @see MM2GSVGProxy::AddCurveToL
- */
- virtual void AddCurveToL(
- const TM2GSvgPathHandle& aPathHandle,
- const TM2GPathCurveData& aPathCurveData);
-
- /**
- * @see MM2GSVGProxy::AddLineToL
- */
- virtual void AddLineToL(
- const TM2GSvgPathHandle& aPathHandle,
- const TReal32& aX, const TReal32& aY);
-
- /**
- * @see MM2GSVGProxy::AddMoveToL
- */
- virtual void AddMoveToL(
- const TM2GSvgPathHandle& aPathHandle,
- const TReal32& aX, const TReal32& aY);
-
- /**
- * @see MM2GSVGProxy::AddQuadToL
- */
- virtual void AddQuadToL(
- const TM2GSvgPathHandle& aPathHandle,
- const TReal32& aX1, const TReal32& aY1,
- const TReal32& aX2, const TReal32& aY2);
-
- /**
- * @see MM2GSVGProxy::AppendChildL
- */
- virtual void AppendChildL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgElementHandle& aChildElementHandle);
-
- /**
- * @see MM2GSVGProxy::BeginElementAtL
- */
- virtual void BeginElementAtL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- const TM2GSvgElementHandle& aElementHandle,
- const TReal32& aOffset);
-
- /**
- * @see MM2GSVGProxy::CheckRemoveableL
- */
- virtual void CheckRemoveableL(
- const TM2GSvgElementHandle& aElementHandle,
- TInt& aRemoveable);
-
- /**
- * @see MM2GSVGProxy::ClearSvgSurfaceL
- */
- virtual void ClearSvgSurfaceL(const TM2GBitmapHandle& aSurfaceHandle);
-
- /**
- * @see MM2GSVGProxy::CreateDocumentL
- */
- virtual void CreateDocumentL(
- const TPtrC16& aData,
- TM2GSvgDocumentHandle& aDocumentHandle);
-
- /**
- * @see MM2GSVGProxy::CreateElementNsL
- */
- virtual void CreateElementNsL(
- const TM2GSvgAttrType& aType,
- const TM2GSvgDocumentHandle& aDocumentHandle,
- TM2GSvgElementHandle& aElementHandle);
-
- /**
- * @see MM2GSVGProxy::CreatePathL
- */
- virtual void CreatePathL(TM2GSvgPathHandle& aPathHandle);
-
-
- /**
- * @see MM2GSVGProxy::CreateSvgEngineL
- */
- virtual void CreateSvgEngineL(TM2GSvgEngineHandle& aEngineHandle);
-
-
- /**
- * @see MM2GSVGProxy::TSvgSurfaceHandleL
- */
- virtual TM2GBitmapHandle CreateSvgSurfaceL(TInt aWidth, TInt aHeight);
-
- /**
- * @see MM2GSVGProxy::DeleteDocumentL
- */
- virtual void DeleteDocumentL(const TM2GSvgDocumentHandle& aDocumentHandle);
-
- /**
- * @see MM2GSVGProxy::DeleteSvgEngineL
- */
- virtual void DeleteSvgEngineL(const TM2GSvgEngineHandle& aEngineHandle);
-
- /**
- * @see MM2GSVGProxy::DeleteSvgSurfaceL
- */
- virtual void DeleteSvgSurfaceL(const TM2GBitmapHandle& aSurfaceHandle);
-
- /**
- * @see MM2GSVGProxy::DestroyPathL
- */
- virtual void DestroyPathL(const TM2GSvgPathHandle& aPathHandle);
-
- /**
- * @see MM2GSVGProxy::DispatchMouseEventL
- */
- virtual void DispatchMouseEventL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- TInt aX, TInt aY, TM2GSvgElementHandle& aElementHandle);
-
- /**
- * @see MM2GSVGProxy::EndElementAtL
- */
- virtual void EndElementAtL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- const TM2GSvgElementHandle& aElementHandle,
- const TReal32& aOffset);
-
- /**
- * @see MM2GSVGProxy::FocusOnL
- */
- virtual void FocusOnL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- const TM2GSvgElementHandle& aElementHandle);
-
- /**
- * @see MM2GSVGProxy::FocusOutL
- */
- virtual void FocusOutL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- const TM2GSvgElementHandle& aElementHandle);
-
- /**
- * @see MM2GSVGProxy::GetBBoxL
- */
- virtual void GetBBoxL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgAttrType& aAttributeType,
- TM2GRectData& aRectData, TInt& aResult);
-
- /**
- * @see MM2GSVGProxy::GetColorTraitL
- */
- virtual void GetColorTraitL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgAttrType& aAttributeType,
- TM2GColorData& aColor,
- TInt& aResult);
-
- /**
- * @see MM2GSVGProxy::GetElementByIdL
- */
- virtual void GetElementByIdL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- const TPtrC16& aId,
- TM2GSvgElementHandle& aElementHandle);
-
- /**
- * @see MM2GSVGProxy::GetElementTypeIdL
- */
- virtual void GetElementTypeIdL(const TM2GSvgElementHandle& aElementHandle, TInt16& aId);
-
- /**
- * @see MM2GSVGProxy::GetEnumAttributeL
- */
- virtual void GetEnumTraitL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgAttrType& aAttributeType,
- TInt16& aEnumTrait);
-
- /**
- * @see MM2GSVGProxy::GetExternalItemL
- */
- virtual TInt GetExternalListItemL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- TInt aIndex,
- TPtrC16& aItem);
-
- /**
- * @see MM2GSVGProxy::GetExternalListSizeL
- */
- virtual void GetExternalListSizeL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- TInt& aListSz);
-
- /**
- * @see MM2GSVGProxy::GetFirstElementChildL
- */
- virtual void GetFirstElementChildL(
- const TM2GSvgElementHandle& aElementHandle,
- TM2GSvgElementHandle& aChildHandle);
-
- /**
- * @see MM2GSVGProxy::GetFloatTraitL
- */
- virtual void GetFloatTraitL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgAttrType& aAttributeType,
- TReal32& aFloatTrait);
-
- /**
- * @see MM2GSVGProxy::GetMatrixTraitL
- */
- virtual void GetMatrixTraitL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgAttrType& aAttributeType,
- TM2GMatrixData& aMatrix, TInt& aResult);
-
- /**
- * @see MM2GSVGProxy::GetMediaTimeL
- */
- virtual void GetMediaTimeL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- TReal32& aSeconds);
-
- /**
- * @see MM2GSVGProxy::GetNextElementSiblingL
- */
- virtual void GetNextElementSiblingL(
- const TM2GSvgElementHandle& aElementHandle,
- TM2GSvgElementHandle& aSiblingElementHandle);
-
- /**
- * @see MM2GSVGProxy::GetNumberOfSegmentsL
- */
- virtual void GetNumberOfSegmentsL(
- const TM2GSvgPathHandle& aPathHandle,
- TInt& aNumberOfSegments);
-
- /**
- * @see MM2GSVGProxy::GetParentL
- */
- virtual void GetParentL(
- const TM2GSvgElementHandle& aElementHandle,
- TM2GSvgElementHandle& aParentElementHandle);
-
- /**
- * @see MM2GSVGProxy::GetPathTraitL
- */
- virtual void GetPathTraitL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgAttrType& aAttributeType,
- TInt& aPathTrait);
-
- /**
- * @see MM2GSVGProxy::GetRectTraitL
- */
- virtual void GetRectTraitL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgAttrType& aAttributeType,
- TM2GRectData& aRectData, TInt& aResult);
-
- /**
- * @see MM2GSVGProxy::GetRootElementL
- */
- virtual void GetRootElementL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- TM2GSvgElementHandle& aRootElementHandle);
-
- /**
- * @see MM2GSVGProxy::GetScreenBBoxL
- */
- virtual void GetScreenBBoxL(
- const TM2GSvgElementHandle& aElementHandle,
- TM2GScreenBBoxData& aScreenBBoxData);
-
- /**
- * @see MM2GSVGProxy::GetSegmentParameterL
- */
- virtual void GetSegmentParameterL(
- const TM2GSvgPathHandle& aPathHandle,
- TInt aSegmentIndex, TInt aParamIndex,
- TReal32& aSegmentParam);
-
- /**
- * @see MM2GSVGProxy::GetSegmentTypeL
- */
- virtual void GetSegmentTypeL(
- const TM2GSvgPathHandle& aPathHandle,
- TInt aSegmentIndex,
- TInt16& aSegmentType);
-
- /**
- * @see MM2GSVGProxy::GetStringTraitL
- */
- virtual TInt GetStringTraitL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgAttrType& aAttributeType,
- TPtrC16& aStr);
-
-
- /**
- * @see MM2GSVGProxy::GetSvgSurfaceHeightL
- */
- virtual TInt GetSvgSurfaceHeightL(const TM2GBitmapHandle& aSurfaceHandle);
-
- /**
- * @see MM2GSVGProxy::GetSvgSurfaceWidthL
- */
- virtual TInt GetSvgSurfaceWidthL(const TM2GBitmapHandle& aSurfaceHandle);
-
- /**
- * @see MM2GSVGProxy::GetUsedFromElement
- */
- virtual void GetUsedFromElementL(
- const TM2GSvgElementHandle& aElementHandle,
- TM2GSvgElementHandle& aHandle);
-
- /**
- * @see MM2GSVGProxy::GetViewportHeightL
- */
- virtual void GetViewportHeightL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- TInt& aHeight);
-
- /**
- * @see MM2GSVGProxy::GetViewportWidthL
- */
- virtual void GetViewportWidthL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- TInt& aWidth);
-
- /**
- * @see MM2GSVGProxy::InitViewportL
- */
- virtual void InitViewportL(
- const TM2GSvgDocumentHandle& aDocumentHandle);
-
- /**
- * @see MM2GSVGProxy::InsertBeforeL
- */
- virtual void InsertBeforeL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgElementHandle& aNewChildElementHandle,
- const TM2GSvgElementHandle& aReferenceElementHandle);
-
- /**
- * @see MM2GSVGProxy::IsActiveL
- */
- virtual void IsActiveL(
- const TM2GSvgElementHandle& aElementHandle,
- TInt& aActive);
-
- /**
- * @see MM2GSVGProxy::IsElementInDomL
- */
- virtual void IsElementInDomL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- const TM2GSvgElementHandle& aElementHandle,
- TInt& aIsElementInDom);
-
- /**
- * @see MM2GSVGProxy::IsUsedL
- */
- virtual void IsUsedL(
- const TM2GSvgElementHandle& aElementHandle,
- TInt& aResult);
-
- /**
- * @see MM2GSVGProxy::RemoveChildL
- */
- virtual void RemoveChildL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgElementHandle& aChildElementHandle,
- TM2GSvgElementHandle& aHandle);
-
- /**
- * @see MM2GSVGProxy::RenderDocumentL
- */
- virtual void RenderDocumentL(
- const TM2GSvgEngineHandle& aEngineHandle,
- const TM2GSvgDocumentHandle& aDocumentHandle,
- const TM2GBitmapHandle& aSurfaceHandle,
- TM2GBitmapHandle aSurfaceMaskHandle,
- TReal32 aCurrentTime);
-
-// pankaj Qimage related changes TODO following Changes done
- virtual void RenderDocumentL(
- const TM2GSvgEngineHandle& aEngineHandle,
- const TM2GSvgDocumentHandle& aDocumentHandle,
- const TM2GSvgBitmapHandle& aSurfaceHandle,
- TM2GSvgBitmapHandle aSurfaceMaskHandle,
- TReal32 aCurrentTime);
- /**
- * @see MM2GSVGProxy::RenderQualityL
- */
- virtual void RenderQualityL(
- const TM2GSvgEngineHandle& aEngineHandle,
- TInt aQuality);
- /**
- * @see MM2GSVGProxy::RequestCompletedL
- */
- virtual void RequestCompletedL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- const TPtrC16& aURI,
- const TPtrC8& aResourceData,
- TInt& aCompleted);
-
- /**
- * @see MM2GSVGProxy::SetColorTraitL
- */
- virtual void SetColorTraitL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgAttrType& aAttributeType,
- const TM2GColorData& aColor);
-
- /**
- * @see MM2GSVGProxy::SetEnumTraitL
- */
- virtual void SetEnumTraitL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgAttrType& aAttributeType,
- TInt16 aValue);
-
- /**
- * @see MM2GSVGProxy::SetFloatTraitL
- */
- virtual void SetFloatTraitL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgAttrType& aAttributeType,
- const TReal32& aValue);
-
- /**
- * @see MM2GSVGProxy::SetMatrixTraitL
- */
- virtual void SetMatrixTraitL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgAttrType& aAttributeType,
- const TM2GMatrixData& aMatrix);
-
- /**
- * @see MM2GSVGProxy::SetMediaTimeL
- */
- virtual void SetMediaTimeL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- const TReal32& aSeconds);
-
- /**
- * @see MM2GSVGProxy::SetPathTraitL
- */
- virtual void SetPathTraitL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgAttrType& aAttributeType,
- const TM2GSvgPathHandle& aPathHandle);
-
- /**
- * @see MM2GSVGProxy::SetRectTraitL
- */
- virtual void SetRectTraitL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgAttrType& aAttributeType,
- const TM2GRectData& aRect);
-
- /**
- * @see MM2GSVGProxy::SetRenderingQualityL
- */
- virtual void SetRenderingQualityL(
- const TM2GSvgEngineHandle& aEngineHandle,
- TInt aMode);
-
- /**
- * @see MM2GSVGProxy::SetStringTraitL
- */
- virtual void SetStringTraitL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgAttrType& aAttributeTypeId,
- const TPtrC16& aStr);
-
- /**
- * @see MM2GSVGProxy::SetViewportHeightL
- */
- virtual void SetViewportHeightL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- TInt aHeight);
-
-
- /**
- * @see MM2GSVGProxy::SetViewportWidthL
- */
- virtual void SetViewportWidthL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- TInt aWidth);
-
-protected: // METHODS
- /**
- * Close engine & document containers
- */
- virtual void CloseContainers();
-
-private: // METHODS
- /**
- * C++ default constructor.
- */
- CM2GSVGProxy();
-
- /**
- * Initialization.
- */
- void ConstructL();
-
- /**
- * C++ copy constructor
- */
- CM2GSVGProxy(const CM2GSVGProxy&);
-
- /**
- * C++ assignment operator
- */
- CM2GSVGProxy& operator=(const CM2GSVGProxy&);
-
-private: // VARIABLES
- CSvgJavaInterfaceImpl* iNative;
- RArray<TM2GSvgEngineHandle> iSvgEngines;
- RArray<TM2GSvgDocumentHandle> iSvgDocuments;
-};
-
-M2G_NS_END
-
-#endif // CM2GSVGPROXY_H
-
-
--- a/javauis/m2g_qt/inc/CSynchronization.h Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-/*
-* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: M3GCore function call serialization and synchronization
-*
-*/
-
-#ifndef CSYNCHRONIZATION_H
-#define CSYNCHRONIZATION_H
-
-// INCLUDE FILES
-#include <e32std.h>
-#include <e32base.h>
-
-// CLASS DECLARATION
-/**
- * @class CSynchronization
- */
-class CSynchronization : public CBase
-{
-public:
- /**
- * Two-phased constructor.
- */
- static CSynchronization* InstanceL();
-
- /**
- * Dtor
- */
- ~CSynchronization();
-
- /**
- * Locks the semaphore
- */
- void Lock();
-
- /**
- * Unlocks the semaphore
- */
- void Unlock();
-
- /**
- * Sets error code for error occured during lock period
- */
- void SetErrorCode(TInt aCode);
-
- /**
- * Returns error string set with SetErrorString
- */
- TInt GetErrorCode();
-
-private: // METHODS
- /**
- * Constructor
- */
- CSynchronization();
-
- /**
- * Two-phased constructor.
- * @return New object
- */
- static CSynchronization* NewL();
-
- /**
- * Constructor
- */
- void ConstructL();
-
-private: // MEMBER VARIABLES
- static CSynchronization* iSelf;
- RCriticalSection iGuard;
- TInt iErrorCode;
-};
-
-#endif // CSYNCHRONIZATION_H
--- a/javauis/m2g_qt/inc/JcfAutoPtr.h Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,147 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef JCFAUTOPTR_H
-#define JCFAUTOPTR_H
-
-#include <e32base.h>
-
-/**
- * Functionality of this auto ptr class is same as stl's auto_ptr class
- * except this works with cleanup stack.
- * Implementation of the example operation with "traditional" way:
- * void bar()
- * {
- * CFoo* myFoo = CFoo::NewL();
- * CleanupStack::PushL(myFoo);
- * myFoo->DoSomeThingL();
- * CleanupStack::PopAndDestroy(1); //myFoo
- * }
- * Implementation of the same function with auto pointer class:
- * void bar()
- * {
- * jcfcommon::auto_ptr<CFoo> myFoo(CFoo::NewL());
- * myFoo->DoSomeThingL();
- * }
- *
- */
-namespace jcfcommon
-{
-
-template<class X> class auto_ptr
-{
-public:
- typedef X element_type;
-
- auto_ptr(X* aPtr = 0): iPtr(aPtr),iCloseCalledFlag(EFalse)
- {
- CleanupStack::PushL(TCleanupItem(Close, (void*)this));
- }
-
- /**
- * Copy constructor was commented out because current
- * implementation doesn't support situation where auto_ptr
- * is returned as return value of the function. Problem is that
- * orig. auto_ptr is deleted when getBar() operation has been
- * executed and this deleted local reference has been stored to the
- * cleanup stack.
- * E.g:
- * void foo()
- * {
- * auto_ptr<bar> barObj = getBar();
- * .
- * .
- * .
- * User::Leave(KErrNotFound);
- * }
- */
- /*auto_ptr(auto_ptr& aPtr): iPtr(aPtr.release())
- {
- CleanupStack::PushL(TCleanupItem(Close, (void*)this));
- }*/
-
- auto_ptr<X>& operator=(auto_ptr<X>& aRhs)
- {
- if (&aRhs != this)
- {
- delete iPtr;
- iPtr = aRhs.release();
- }
- return (*this);
- }
-
- ~auto_ptr()
- {
- if (!iCloseCalledFlag)
- {
- CleanupStack::Pop();
- delete iPtr;
- }
- }
-
- X& operator *() const
- {
- return *iPtr;
- }
- X* operator ->() const
- {
- return iPtr;
- }
-
- X* get() const
- {
- return iPtr;
- }
-
- X* release()
- {
- X* result = iPtr;
- iPtr = 0;
- return result;
- }
-
- void reset(X* aPtr = 0)
- {
- if (aPtr != iPtr)
- {
- delete iPtr;
- iPtr = aPtr;
- }
- }
-
-private:
- static void Close(void* aPtr)
- {
- auto_ptr<X>* self = (auto_ptr<X>*)aPtr;
- delete self->iPtr;
- self->iPtr = 0;
- self->iCloseCalledFlag = ETrue;
- }
-
- //Not implemented.
- auto_ptr(auto_ptr& aPtr);
-
-private:
- X* iPtr;
- TBool iCloseCalledFlag;
-};
-
-}//end jcfcommon
-
-#endif // JCFAUTOPTR_H
-
-
--- a/javauis/m2g_qt/inc/M2GGeneral.h Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,463 +0,0 @@
-/*
-* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: General definitions
-*
-*/
-
-#ifndef M2GGENERAL_H
-#define M2GGENERAL_H
-
-#include <e32base.h>
-#include <jutils.h>
-
-#if defined ( _DEBUG )
-#if defined ( __WINSCW__ )
-// #define M2G_DEBUG
-#endif // __WINSCW__
-#endif // _DEBUG
-
-#ifdef M2G_DEBUG
-// #define M2G_INFO_POPUP
-#define M2G_STATISTIC_DEBUG
-#include <flogger.h>
-#include <jdebug.h>
-#ifdef M2G_STATISTIC_DEBUG
-#include <HAL.h>
-#include <hal_data.h>
-#endif // M2G_STATISTIC_DEBUG
-#endif // M2G_DEBUG
-
-#include "JcfAutoPtr.h"// cfcommon::auto_ptr<>
-#include "M2GNamespace.h"
-
-//#if defined( __cplusplus )
-//extern "C" {
-//#endif
-
-M2G_NS_START
-
-// CONSTANTS
-// == ALPHA BLEND CONSTANTS ==
-const TUint8 KFullOpaque = 0xFF;
-const TUint8 KFullTransparent = 0x00;
-
-// == ERROR TEXT CONSTANTS ==
-_LIT8(KM2GEmptyString8, "");
-_LIT(KM2GEmptyString, "");
-_LIT(KGraphicsContextErrText, "Invalid M2G graphics context");
-_LIT(KOffscreenErrText, "Invalid M2G offscreen bitmap");
-_LIT(KSvgProxyPointerErrText, "Invalid SVG proxy pointer");
-_LIT(KSvgEnginePointerErrText, "Invalid SVG engine pointer");
-_LIT(KSvgTargetGraphicsPointerErrText, "Invalid target graphics pointer");
-_LIT(KNotSupportedErrText, "Not supported");
-
-// == ERROR CODE CONSTANTS ==
-const TInt KM2GOk = KErrNone;
-const TInt KM2GNotOk = KErrGeneral;
-const TInt KM2GHandleNotOk = KErrBadHandle;
-const TInt KM2GArgNotOk = KErrArgument;
-const TInt KM2GSupportedNotOk = KErrNotSupported;
-const TInt KM2GMemoryNotOk = KErrNoMemory;
-
-// Own error codes
-const TInt KM2GIOException = -10;
-
-// Java exception class names
-_LIT8(KJavaExceptionClass, "java/lang/Exception");
-_LIT8(KJavaIOExceptionClass, "java/io/IOException");
-_LIT8(KJavaOutOfMemoryErrorClass, "java/lang/OutOfMemoryError");
-_LIT8(KJavaNullPointerException, "java/lang/NullPointerException");
-
-// == SVG CONSTANTS ==
-const TInt KM2GRestartAttribute = 114; // M2GSVGConstants.AT_RESTART
-const TInt KM2GRestartNever = 471; // M2GSVGConstants.RESTART_NEVER
-const TInt KM2GRestartWhenNotActive = 472; // M2GSVGConstants.RESTART_WHENNOTACTIVE
-
-// == HANDLE MACROS ==
-#define M2G_INVALID_HANDLE /**/ 0
-
-// FORWARD DECLARATIONS
-class RWriteStream;
-
-// FUNCTION PROTOTYPES
-
-// CLASS DECLARATION
-/**
- * General static methods
- * @lib -
- * @series Series S60 3.0
- */
-class M2GGeneral
-{
-public: // STATIC METHODS
- /**
- * Check if a handle is valid
- * @since Series S60 3.0
- * @param aHandle
- * @return ETrue if a handle is valid.
- */
- template<typename T>
- inline static TBool IsHandleValid(const T& aHandle)
- {
- return ((aHandle == M2G_INVALID_HANDLE) ? EFalse : ETrue);
- }
-
- /**
- * Returns min
- * @since Series S60 3.0
- * @param a Left parameter
- * @param b Right parameter
- * @return Returns min
- */
- template<typename T>
- inline static T Min(const T& a, const T& b)
- {
- return ((a) <= (b) ? (a) : (b));
- }
-
-
- /**
- * Returns max
- * @since Series S60 3.0
- * @param a Left parameter
- * @param b Right parameter
- * @return Returns max
- */
- template<typename T>
- inline static T Max(const T& a, const T& b)
- {
- return ((a) >= (b) ? (a) : (b));
- }
- /**
- * Instantiates an Java exception object with the message specified by
- * message, and causes that exception to be thrown in Java side. A thrown
- * exception will be pending in the current thread, but does not
- * immediately disrupt native code execution.
- * @param aEnv pointer to JNI environment
- * @param aName The name of a java.lang.Throwable class.
- * @param aMsg The message used to construct the java.lang.Throwable object.
- */
- static void RaiseException(
- JNIEnv* aEnv,
- const TDesC8& aName,
- const TUint8* aMsg = (STATIC_CAST(const TDesC8&, KM2GEmptyString8)).Ptr());
-
- /**
- * Instantiates an Java exception object specified by error code,
- * and causes that exception to be thrown in Java side.
- * @param aEnv pointer to JNI environment
- * @param aErrorCode Error code.
- * @return Value passed in is returned if not an error.
- */
- static TInt CheckErrorCode(JNIEnv* aEnv, TInt aErrorCode);
-
- /**
- * If handle is invalid instantiates an Java exception object,
- * and causes that exception to be thrown in Java side.
- * @param aEnv pointer to JNI environment
- * @param aHandle Handle.
- * @return Handle passed in is returned if it is not invalid.
- */
- static TInt CheckHandle(JNIEnv* aEnv, TInt aHandle);
-
- /**
- * If handle is invalid or error code matches instantiates an
- * Java exception object, and causes that exception to be thrown in Java side.
- * @param aEnv pointer to JNI environment
- * @param aErrorCode
- * @param aHandle Handle.
- * @param aErrorResult Result that is returned if error.
- * @return Handle passed in is returned if no error otherwise the
- * .aErrorResult is returned.
- */
- static TInt CheckErrorCodeAndHandle(
- JNIEnv* aEnv, TInt aErrorCode, TInt aHandle, TInt aErrorResult);
-
- /**
- * Shows pop up dialog on the emulator
- * @since Series S60 3.1
- * @param aLine1
- * @param aLine2
- */
-#ifdef M2G_INFO_POPUP
- static void PopupInfo(
- const TDesC& aLine1,
- const TDesC& aLine2);
-#endif // M2G_INFO_POPUP
-
-
- /**
- * Data array wrapper.
- * @series Series S60 3.1
- */
- template <typename T>
- class TDataArrayPtr
- {
-
- public: // METHODS
- /**
- * Ctor
- */
- TDataArrayPtr(T* aData = 0, TInt aSize = 0) : iData(aData), iSize(aSize) {}
-
- /**
- * Return pointer to a data
- * @return Pointer
- */
- inline T* Begin()
- {
- return iData;
- }
-
- /**
- * Check if data is valid
- * @return ETrue if ok
- */
- inline TBool IsValid()
- {
- return (((iData != NULL) && (iSize > 0)) ? ETrue : EFalse);
- }
-
- /**
- * Return data size
- * @return Length
- */
- inline TInt Length()
- {
- return iSize;
- }
-
- /**
- * Operator [] const
- */
- inline const T& operator[](TInt aIndex) const
- {
- return iData[ aIndex ];
- }
-
- /**
- * Operator []
- */
- inline T& operator[](TInt aIndex)
- {
- return iData[ aIndex ];
- }
-
- private: // METHODS
-
- /**
- * Copy ctor
- * @param aRhs Right side array
- */
- TDataArrayPtr(const TDataArrayPtr& aRhs);
-
- /**
- * Assignment operator
- * @param aRhs Right side array
- * @return Array object
- */
- TDataArrayPtr& operator=(const TDataArrayPtr& aRhs);
-
- public: // VARIABLES
- T* iData;
- TInt iSize;
- };
-
-
- /**
- * Statistic info
- * @series Series S60 3.1
- */
-#ifdef M2G_STATISTIC_DEBUG
- class TM2GStatistic
- {
- public: // METHODS
- /**
- * Ctor
- */
- TM2GStatistic();
-
- /**
- * Reset
- */
- void Reset();
-
- /**
- * Print
- * @param aPrintElapsedTime Print also en elapsed time
- */
- void Print(TBool aPrintElapsedTime = EFalse);
-
- /**
- * Print
- * @param aStream
- */
- void Print(RWriteStream& aStream);
-
- public: // STATIC METHODS
- static void Log();
-
- private: // METHODS
- /**
- * Copy ctor
- */
- TM2GStatistic(const TM2GStatistic&);
-
- /**
- * Assignment operator
- */
- TM2GStatistic& operator=(const TM2GStatistic&);
-
- private: // VARIABLES
- TTime iStartTime;
- TTime iEndTime;
- TThreadId iId;
- TName iThreadName;
- };
-#endif // M2G_STATISTIC_DEBUG
-
-private: // METHODS
- /**
- * Default constructor
- */
- M2GGeneral() {};
-
- /**
- * Copy constructor
- */
- M2GGeneral(const M2GGeneral&);
-
- /**
- * Assignment operator
- */
- M2GGeneral& operator=(const M2GGeneral&);
-};
-
-// MACROS
-// == TOOL MACROS ==
-#define M2G_MIN( a, b ) ( ( a ) <= ( b ) ? ( a ) : ( b ) )
-#define M2G_MAX( a, b ) ( ( a ) >= ( b ) ? ( a ) : ( b ) )
-
-// == SWITCHES ==
-#define M2G_NO_EXCEPTION_SWITCH
-// #define M2G_NO_NULL_POINTER_EXCEPTION_SWITCH
-
-#if defined( M2G_DEBUG )
-#define M2G_TRACE
-#endif
-
-// == EXCEPTION MACROS ==
-// Common exception handling
-#ifndef M2G_NO_EXCEPTION_SWITCH
-#define M2G_THROW( ERR_CODE ) /**/ User::Leave( ( ERR_CODE ) )
-#define M2G_THROW2( ERR_TEXT, ERR_CODE ) /**/ M2G_DEBUG_0( ERR_TEXT ); User::Leave( ( ERR_CODE ) )
-#else
-#define M2G_THROW( ERR_CODE ) /**/
-#define M2G_THROW2( ERR_TEXT, ERR_CODE ) /**/
-#endif // !M2G_NO_EXCEPTION_SWITCH
-
-// Null pointer exception handling
-#ifndef M2G_NO_NULL_POINTER_EXCEPTION_SWITCH
-#define M2G_CHECK_NULL_POINTER( JNI, POINTER ) /**/ M2GGeneral::CheckHandle( ( JNI, POINTER ) )
-#else
-#define M2G_CHECK_NULL_POINTER( JNI, POINTER ) /**/
-#endif // !M2G_NO_NULL_POINTER_EXCEPTION_SWITCH
-
-
-// == STATIC LOG MACROS ==
-#if defined( M2G_STATISTIC_DEBUG )
-#define M2G_STATISTIC_LOG /**/ M2GGeneral::TM2GStatistic::Log()
-#else // M2G_STATISTIC_DEBUG
-#define M2G_STATISTIC_LOG /**/
-#endif // !M2G_STATISTIC_DEBUG
-
-// == POPUP MACROS ==
-#if defined( M2G_INFO_POPUP )
-#define M2G_POPUP( LINE1, LINE2 ) /**/ M2GGeneral::PopupInfo( LINE1, LINE2 );
-#else // !M2G_INFO_POPUP
-#define M2G_POPUP( LINE1, LINE2 ) /**/
-#endif // M2G_INFO_POPUP
-
-// == TRACE MACROS ==
-#if defined( M2G_TRACE )
-#define M2G_DEBUG_0( TEXT ) /**/ \
- RFileLogger::Write( KLogDirectory, KLogFileName, EFileLoggingModeAppend, _L( TEXT ) )
-
-#define M2G_DEBUG_1( TEXT, VAL1 ) /**/ \
- RFileLogger::WriteFormat( KLogDirectory, KLogFileName, EFileLoggingModeAppend, /**/ \
- _L( TEXT ), VAL1 )
-
-#define M2G_DEBUG_2( TEXT, VAL1, VAL2 ) /**/ \
- RFileLogger::WriteFormat( KLogDirectory, KLogFileName, EFileLoggingModeAppend, /**/ \
- _L( TEXT ), VAL1, VAL2 )
-
-#define M2G_DEBUG_3( TEXT, VAL1, VAL2, VAL3 ) /**/ \
- RFileLogger::WriteFormat( KLogDirectory, KLogFileName, EFileLoggingModeAppend, /**/ \
- _L( TEXT ), VAL1, VAL2, VAL3 )
-
-#define M2G_DEBUG_4( TEXT, VAL1, VAL2, VAL3, VAL4 ) /**/ \
- RFileLogger::WriteFormat( KLogDirectory, KLogFileName, EFileLoggingModeAppend, /**/ \
- _L( TEXT ), VAL1, VAL2, VAL3, VAL4 )
-
-#define M2G_DEBUG_5( TEXT, VAL1, VAL2, VAL3, VAL4, VAL5 ) /**/ \
- RFileLogger::WriteFormat( KLogDirectory, KLogFileName, EFileLoggingModeAppend, /**/ \
- _L( TEXT ), VAL1, VAL2, VAL3, VAL4, VAL5 )
-
-#define M2G_DEBUG_6( TEXT, VAL1, VAL2, VAL3, VAL4, VAL5, VAL6 ) /**/ \
- RFileLogger::WriteFormat( KLogDirectory, KLogFileName, EFileLoggingModeAppend, /**/ \
- _L( TEXT ), VAL1, VAL2, VAL3, VAL4, VAL5, VAL6 )
-
-#define M2G_DEBUG_7( TEXT, VAL1, VAL2, VAL3, VAL4, VAL5, VAL6, VAL7 ) /**/ \
- RFileLogger::WriteFormat( KLogDirectory, KLogFileName, EFileLoggingModeAppend, /**/ \
- _L( TEXT ), VAL1, VAL2, VAL3, VAL4, VAL5, VAL6, VAL7 )
-#else // !M2G_TRACE
-#define M2G_POPUP( LINE1, LINE2 ) /**/
-
-#define M2G_DEBUG_0( TEXT ) /**/
-#define M2G_DEBUG_1( TEXT, VAL1 ) /**/
-#define M2G_DEBUG_2( TEXT, VAL1, VAL2 ) /**/
-#define M2G_DEBUG_3( TEXT, VAL1, VAL2, VAL3 ) /**/
-#define M2G_DEBUG_4( TEXT, VAL1, VAL2, VAL3, VAL4 ) /**/
-#define M2G_DEBUG_5( TEXT, VAL1, VAL2, VAL3, VAL4, VAL5 ) /**/
-#define M2G_DEBUG_6( TEXT, VAL1, VAL2, VAL3, VAL4, VAL5, VAL6 ) /**/
-#define M2G_DEBUG_7( TEXT, VAL1, VAL2, VAL3, VAL4, VAL5, VAL6, VAL7 ) /**/
-#endif // M2G_TRACE
-
-// DATA TYPES
-typedef TInt TM2GSvgEngineHandle;
-typedef TInt TM2GSvgDocumentHandle;
-typedef TInt TM2GSvgElementHandle;
-typedef TInt TM2GBitmapHandle;
-typedef TInt TM2GSvgPathHandle;
-typedef TInt16 TM2GSvgAttrType;
-typedef TUint8 TM2GPixelComponent;
-
-//For Qimage related changes
-typedef TUint TM2GSvgBitmapHandle;
-
-typedef TFixedArray<TInt, 3> TM2GColorData;
-typedef TFixedArray<TReal32, 6> TM2GMatrixData;
-typedef M2GGeneral::TDataArrayPtr<TReal32> TM2GMatrixData2;
-typedef TFixedArray<TReal32, 4> TM2GRectData;
-typedef TFixedArray<TReal32, 4> TM2GScreenBBoxData;
-typedef TFixedArray<TReal32, 6> TM2GPathCurveData;
-
-
-M2G_NS_END
-
-//#if defined( __cplusplus )
-//} // extern "C"
-//#endif
-
-#endif // M2GGENERAL_H
--- a/javauis/m2g_qt/inc/M2GNamespace.h Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
-* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Namespace definitions
-*
-*/
-
-#ifndef M2GNAMESPACE_H
-#define M2GNAMESPACE_H
-// INCLUDES
-
-// CONSTANTS
-
-// MACROS
-
-#define M2G_NO_NAMESPACE_SWITCH
-#ifndef M2G_NO_NAMESPACE_SWITCH
-#define M2G_NS_ /**/ m2g_namespace
-#define M2G_NS_START /**/ namespace M2G_NS_ {
-#define M2G_NS_END /**/ }
-#define M2G_NS(X) /**/ ::M2G_NS_::X
-#define USING_WHOLE_M2G_NS /**/ using namespace ::M2G_NS_;
-#define USING_M2G_NS(X) /**/ using ::M2G_NS_::X;
-#else
-#define M2G_NS_ /**/
-#define M2G_NS_START /**/
-#define M2G_NS_END /**/
-#define M2G_NS(X) /**/
-#define USING_WHOLE_M2G_NS /**/
-#define USING_M2G_NS(X) /**/
-#endif // !M2G_NO_NAMESPACE_SWITCH
-
-// DATA TYPES
-
-// FUNCTION PROTOTYPES
-
-// FORWARD DECLARATIONS
-
-// CLASS DECLARATION
-
-#endif // M2GNAMESPACE_H
--- a/javauis/m2g_qt/inc/M2GUtils.h Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,427 +0,0 @@
-/*
-* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: General functions
-*
-*/
-
-#ifndef M2GUTILS_H
-#define M2GUTILS_H
-
-// INCLUDE FILES
-#include <gdi.h> // DisplayMode, Draw, BitBlt
-#include <fbs.h> // CFbsBitmap
-#include "M2GGeneral.h"
-#include <QPixmap>
-
-M2G_NS_START
-
-// CONSTANTS
-
-// DATA TYPES
-
-// MACROS
-
-// FORWARD DECLARATIONS
-class CFbsBitmapDevice;
-class CFbsBitGc;
-
-// FUNCTION PROTOTYPES
-
-// CLASS DECLARATION
-
-
-//For UI Thread Execution.
-#include "CSynchronization.h"
-
-#define M2G_DO_LOCK CSynchronization::InstanceL()->Lock();
-
-
-//TODO Have to Raise Exception in case we find any error.
-#define M2G_DO_UNLOCK(aEnv) {\
- TInt errorCode = CSynchronization::InstanceL()->GetErrorCode();\
- CSynchronization::InstanceL()->Unlock();\
- }\
-
-/**
- * @class M2GBitmapUtils
- * @brief Static methods for alpha blending and bitmaps
- */
-
-class M2GBitmapUtils
-{
-public: // STATIC METHODS
- /**
- * Blits two bitmap
- * @since Series S60 3.0
- * @param aTarget Target bitmap.
- * @param aSource Source bitmap.
- * @param aPoint Position for the top left corner of the bitmap.
- * @param aRect Rectangle defining the piece of the bitmap to be drawn.
- * @param aSourceMask Mask.
- * @return M2G_OK if ok
- */
- static TInt BitBlt(CFbsBitmap& aTarget,
- const CFbsBitmap& aSource,
- const TPoint& aPoint,
- const TRect* aRect = NULL,
- const CFbsBitmap* aSourceMask = NULL);
-
- static TInt BitBlt(CBitmapContext& aTargetContext,
- const CFbsBitmap& aSource,
- const TPoint& aPoint,
- const TRect* aRect,
- const CFbsBitmap* aSourceMask,
- /*MSwtClient* aClientHandle,*/
- TBool aUseNativeClear = EFalse);
-
- static TInt BitQBlt(QImage& aTargetQimage,
- const QImage& aSourceQimage,
- const TPoint& aPoint,
- const TRect* aRect,
- const CFbsBitmap* aSourceMask);
-
- /**
- * Checks if two bitmap are equal.
- * @since Series S60 3.0
- * @param aLhs Left side bitmap
- * @param aRhs Right side bitmap
- * @return ETrue if bitmaps are equal.
- */
- inline static TBool Equals(const CFbsBitmap& aLhs, const CFbsBitmap& aRhs)
- {
- return (aLhs.SizeInPixels() == aRhs.SizeInPixels());
- }
-
- /**
- * Checks if a bitmap has same values as given values.
- * @since Series S60 3.0
- * @param aBitmap Bitmap
- * @param aSz Size in pixels.
- * @param aMode Display mode.
- * @return ETrue if bitmaps are equal.
- */
- inline static TBool Equals(
- const CFbsBitmap& aBitmap,
- const TSize& aSz,
- const TDisplayMode* aMode)
- {
- return (((aBitmap.SizeInPixels() == aSz) &&
- ((aMode == NULL) || (aBitmap.DisplayMode() == *aMode))
- ) ? ETrue : EFalse);
- }
-
- /**
- * Return byte per pixel
- * @since Series S60 3.1
- * @param aBitmap
- * @param aRhs Right side bitmap
- * @return ETrue if bitmaps are equal.
- */
- inline static TInt BytesPerPixel(const CFbsBitmap& aBitmap)
- {
- switch (aBitmap.DisplayMode())
- {
- case EGray256 :
- case EColor256 :
- return 1;
- case EColor64K :
- return 2;
- case EColor16M :
- case EColor16MU :
- case EColor16MA :
- return 4;
- default :
- return 0;
- }
- }
-
-};
-
-/**
- * @class TM2GRenderRect
- * @brief Class for handling rendering rectangle
- */
-class TM2GRenderRect : public TRect
-{
-private:
- // NOTE ELength should be always the last one and indexing
- // should start from 0
- enum TArrayIndexes
- {
- EAnchorX = 0,
- EAnchorY = 1,
- EClipX = 2,
- EClipY = 3,
- EClipW = 4,
- EClipH = 5,
- ELength
- };
-
-public: // METHODS
- /**
- * Ctor
- * @since Series S60 3.0
- * @param aAnchorX X anchor
- * @param aAnchorY Y anchor
- * @param aClipX Clip x
- * @param aClipY Clip y
- * @param aClipWidth Clip width
- * @param aClipHeight Clip height
- */
- TM2GRenderRect(
- TInt aAnchorX, TInt aAnchorY,
- TInt aClipX, TInt aClipY,
- TInt aClipW, TInt aClipH);
-
- /**
- * Ctor
- * @since Series S60 3.0
- * @param aDimensions Dimensions. @see TArrayIndexes.
- * @param aLength Array length
- */
- TM2GRenderRect(TInt* aDimensions, TInt aLength);
-
- /**
- * Copy ctor
- * @since Series S60 3.0
- * @param aRd
- */
- TM2GRenderRect(const TM2GRenderRect& aRd);
-
- /**
- * Assignment operator
- * @since Series S60 3.0
- * @param aRd
- * @return TM2GRenderRect
- */
- TM2GRenderRect& operator=(const TM2GRenderRect& aRd);
-
- /**
- * Dtor
- * @since Series S60 3.0
- */
- virtual ~TM2GRenderRect();
-
- /**
- * Returns x anchor
- * @since Series S60 3.0
- * @return X anchor
- */
- inline TInt GetAnchorX()
- {
- return iAnchorX;
- }
-
- /**
- * Returns y anchor
- * @since Series S60 3.0
- * @return Y anchor
- */
- inline TInt GetAnchorY()
- {
- return iAnchorY;
- }
-
- /**
- * Returns clip height
- * @since Series S60 3.0
- * @return Clip height
- */
- inline TInt GetClipH()
- {
- return Height();
- }
-
- /**
- * Returns x clip
- * @since Series S60 3.0
- * @return X clip
- */
- inline TInt GetClipX()
- {
- return iTl.iX;
- }
-
- /**
- * Returns y clip
- * @since Series S60 3.0
- * @return Y clip
- */
- inline TInt GetClipY()
- {
- return iTl.iY;
- }
-
- /**
- * Returns clip width
- * @since Series S60 3.0
- * @return Clip width
- */
- inline TInt GetClipW()
- {
- return Width();
- }
-
- /**
- * Sets x anchor
- * @since Series S60 3.0
- * @param aX X anchor
- */
- inline void SetAnchorX(TInt aX)
- {
- iAnchorX = aX;
- }
-
- /**
- * Sets y anchor
- * @since Series S60 3.0
- * @param aY Y anchor
- */
- inline void SetAnchorY(TInt aY)
- {
- iAnchorY = aY;
- }
-
- /**
- * Sets clip height
- * @since Series S60 3.0
- * @param aH Clip height
- */
- inline void SetClipH(TInt aH)
- {
- SetHeight(aH);
- }
-
- /**
- * Sets x clip
- * @since Series S60 3.0
- * @param aX X clip
- */
- inline void SetClipX(TInt aX)
- {
- iTl.iX = aX;
- }
-
- /**
- * Sets y clip
- * @since Series S60 3.0
- * @param aY Y clip
- */
- inline void SetClipY(TInt aY)
- {
- iTl.iY = aY;
- }
-
- /**
- * Sets clip width
- * @since Series S60 3.0
- * @param aW Clip width
- */
- inline void SetClipW(TInt aW)
- {
- SetWidth(aW);
- }
-
-public: // STATIC METHODS
- /**
- * Gets region size
- * @since Series S60 3.0
- * @param aRect Render dimensions
- * @param aSz Source surface size
- * @return Region size to be paint
- */
- static TSize GetRegionSizeInPixels(
- TM2GRenderRect& aRect,
- const TSize& aSz);
-
-public: // VARIABLES
- TInt iAnchorX;
- TInt iAnchorY;
-};
-
-
-/**
- * @class TM2GBitmapLock
- * @brief Bitmap autolocker
- */
-class TM2GBitmapLock
-{
-public: // METHODS
- /**
- * Ctor
- * @param aBitmap Bitmap
- * @param aLock If ETrue then bitmap is locked by ctor.
- */
- TM2GBitmapLock(const CFbsBitmap* aBitmap, TBool aLock = ETrue);
-
- /**
- * Dtor
- * @since Series S60 3.0
- */
- virtual ~TM2GBitmapLock();
-
- /**
- * Locks bitmap heap
- * @since Series S60 3.0
- */
- void Lock();
-
- /**
- * Unlocks bitmap heap
- * @since Series S60 3.0
- */
- void Unlock();
-
-protected: // METHODS
- /**
- * Copy ctor
- * @since Series S60 3.0
- * @param aRd
- */
- TM2GBitmapLock(const TM2GBitmapLock& aRd);
-
- /**
- * Assignment operator
- * @since Series S60 3.0
- * @param aRd
- * @return TM2GBitmapLock
- */
- TM2GBitmapLock& operator=(const TM2GBitmapLock& aRd);
-
-public: // VARIABLES
- const CFbsBitmap* iBitmap;
- TBool iIsLocked;
-};
-class TSWTBitBlt/*: public MSwtFunctor*/
-{
-public:
- TSWTBitBlt(CBitmapContext& aTargetContext,
- const TPoint& aPoint,
- const CFbsBitmap* aBitmap,
- const TRect* aSourceRect,
- const CFbsBitmap* aMaskBitmap,
- TBool aUseNativeClear);
-
- void operator()() const;
- CBitmapContext& iTargetContext;
- const TPoint iPoint;
- const CFbsBitmap* iBitmap;
- const TRect* iRect;
- const CFbsBitmap* iMaskBitmap;
- TBool iUseNativeClear;
-};
-M2G_NS_END
-
-
-#endif // M2GUTILS_H
--- a/javauis/m2g_qt/inc/MM2GRenderContext.h Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,134 +0,0 @@
-/*
-* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Render context interface
-*
-*/
-
-#ifndef MM2GRENDERCONTEXT_H
-#define MM2GRENDERCONTEXT_H
-
-// INCLUDES
-#include <gdi.h> // TDisplayMode
-#include "M2GUtils.h"
-
-M2G_NS_START
-
-// CONSTANTS
-
-// MACROS
-
-// DATA TYPES
-
-// FUNCTION PROTOTYPES
-
-// FORWARD DECLARATIONS
-
-// CLASS DECLARATION
-/**
- * Interface class
- */
-class MM2GRenderContext
-{
-public: // STATIC CONSTANTS
- static const TReal32 KFullOpaque;
- static const TReal32 KFullTransparency;
- static const TUint8 KMaxAlphaValue;
- static const TDisplayMode KDefaultDisplayMode;
- static const TDisplayMode KMaskDisplayMode;
-
-public: // METHODS
-
- /**
- * Dtor
- */
- virtual ~MM2GRenderContext() {};
-
- /**
- * Binds device's bitmap.
- * @since Series S60 3.1
- * @param aGraphicsHandle Target graphics handle
- * @throws exception if not ok
- */
- virtual void BindL(TInt& aGraphicsHandle) = 0;
-
- /**
- * SVG image bitmap is (re)created if needed.
- * @since Series S60 3.1
- * @see MM2GRenderContext::SetRefreshModeL()
- * @throws exception if not ok
- */
- virtual void InitImageBitmapL() = 0;
-
- /**
- * Blits an svg and a device bitmaps
- * @since Series S60 3.1
- * @throws M2G_OK if ok
- * @throws exception if not ok
- */
- virtual void ReleaseL() = 0;
-
- /**
- * Renders a SVG document at a current time.
- *
- * <p> The rendering is done in 2 steps:
- * <li> render the document on an internal SVG buffer (iSvg)
- * <li> alpha-blend it with the bound graphics target (iGraphicsBitmap)
- *
- * @note if transparency factor is not set, iSvg is simply blitted onto iGraphicsTarget
- *
- * @param aSvgDocumentHandle handle to SVG document
- * @param aCurrentTime the current time of the animation
- * @param aSvgW Svg image viewport width
- * @param aSvgH Svg image viewport height
- * @param aRect contains position about the rendered area
- * @since S60 3.1
- */
-
-
- virtual void RenderLCDUIL(
- TM2GSvgDocumentHandle& aSvgDocHandle,
- const TReal32 aCurrentTime,
- TInt aSvgW,
- TInt aSvgH,
- TM2GRenderRect& aRect) = 0 ;
-
- virtual void RenderESWTL(
- TM2GSvgDocumentHandle& aSvgDocHandle,
- const TReal32 aCurrentTime,
- TInt aSvgW,
- TInt aSvgH,
- TM2GRenderRect& aRect,
- TBool aUseNativeClear,
- TInt* aReturnData) = 0;
-
- /**
- * Sets render quality
- * @since Series S60 3.1
- * @param aMode Mode
- * @throws exception if not ok
- */
- virtual void SetRenderingQualityL(TInt aMode) = 0;
-
- /**
- * Sets transparency
- * @since Series S60 3.1
- * @param aAlpha Alpha factor
- * @throws exception if not ok
- */
- virtual void SetTransparency(TReal32 aAlpha) = 0;
-
-};
-
-M2G_NS_END
-#endif // MM2GRENDERCONTEXT_H
--- a/javauis/m2g_qt/inc/MM2GSVGProxy.h Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,854 +0,0 @@
-/*
-* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: SVGTopt proxy interface
-*
-*/
-
-#ifndef MM2GSVGPROXY_H
-#define MM2GSVGPROXY_H
-
-// INCLUDES
-#include "M2GUtils.h"
-
-M2G_NS_START
-
-// CONSTANTS
-
-// MACROS
-
-// DATA TYPES
-
-// FUNCTION PROTOTYPES
-
-// FORWARD DECLARATIONS
-
-// CLASS DECLARATION
-/**
- * Interface class
- */
-class MM2GSVGProxy
-{
-public: // METHODS
-
- /**
- * Dtor
- */
- virtual ~MM2GSVGProxy() {};
-
- /**
- * Add close to the given path.
- * @since Series S60 3.1
- * @param aPathHandle Path handle.
- * @throws exception if not ok
- */
- virtual void AddCloseL(const TM2GSvgPathHandle& aPathHandle) = 0;
-
- /**
- * Add curve to the given path.
- * @since Series S60 3.1
- * @param aPathHandle Path handle.
- * @param aPathCurveData Curve data
- * @throws exception if not ok
- */
- virtual void AddCurveToL(
- const TM2GSvgPathHandle& aPathHandle,
- const TM2GPathCurveData& aPathCurveData) = 0;
-
- /**
- * Add line to the given path.
- * @since Series S60 3.1
- * @param aPathHandle Path handle.
- * @param aX -
- * @param aY -
- * @throws exception if not ok
- */
- virtual void AddLineToL(
- const TM2GSvgPathHandle& aPathHandle,
- const TReal32& aX, const TReal32& aY) = 0;
- /**
- * Add move to the given path.
- * @since Series S60 3.1
- * @param aPathHandle Path handle.
- * @param aX -
- * @param aY -
- * @throws exception if not ok
- */
- virtual void AddMoveToL(
- const TM2GSvgPathHandle& aPathHandle,
- const TReal32& aX, const TReal32& aY) = 0;
-
- /**
- * Add quad to the given path.
- * @since Series S60 3.1
- * @param aPathHandle Path handle.
- * @param aX1 -
- * @param aY1 -
- * @param aX2 -
- * @param aY2 -
- * @throws exception if not ok
- */
- virtual void AddQuadToL(
- const TM2GSvgPathHandle& aPathHandle,
- const TReal32& aX1, const TReal32& aY1,
- const TReal32& aX2, const TReal32& aY2) = 0;
-
- /**
- * Append child
- * @since Series S60 3.1
- * @param aElementHandle
- * @param aChildElementHandle
- * @throws exception if not ok
- */
- virtual void AppendChildL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgElementHandle& aChildElementHandle) = 0;
-
- /**
- * Set the begin animation time for the given element.
- * @since Series S60 3.1
- * @param aDocumentHandle
- * @param aElementHandle
- * @param aOffset
- * @throws exception if not ok
- */
- virtual void BeginElementAtL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- const TM2GSvgElementHandle& aElementHandle,
- const TReal32& aOffset) = 0;
-
- /**
- * Check if element is removable
- * @since Series S60 3.1
- * @param aSurfaceHandle
- * @param aRemoveable Result
- * @throws exception if not ok
- */
- virtual void CheckRemoveableL(
- const TM2GSvgElementHandle& aElementHandle,
- TInt& aRemoveable) = 0;
-
-
- /**
- * Clear svg surface
- * @since Series S60 3.1
- * @param aSurfaceHandle Surface handle
- * @throws exception if not ok
- */
- virtual void ClearSvgSurfaceL(const TM2GSvgDocumentHandle& aSurfaceHandle) = 0;
-
- /**
- * Create document
- * @since Series S60 3.1
- * @param aData Document content
- * @param aDocumentHandle Document handle to be returned
- * @throws exception if not ok
- */
- virtual void CreateDocumentL(
- const TPtrC16& aData,
- TM2GSvgDocumentHandle& aDocumentHandle) = 0;
-
- /**
- * Create svg engine
- * @since Series S60 3.1
- * @param aEngineHandle Svg engine handle
- * @throws exception if not ok
- */
- virtual void CreateSvgEngineL(TM2GSvgEngineHandle& aEngineHandle) = 0;
-
- /**
- * Create path
- * @since Series S60 3.1
- * @param aPathHandle Path handle to be returned
- * @throws exception if not ok
- */
- virtual void CreatePathL(TM2GSvgPathHandle& aPathHandle) = 0;
-
- /**
- * Create svg surface
- * @since Series S60 3.1
- * @param aWidth Surface width
- * @param aHeight Surface height
- * @return Svg surface
- * @throws exception if not ok
- */
- virtual TM2GBitmapHandle CreateSvgSurfaceL(TInt aWidth, TInt aHeight) = 0;
-
- /**
- * Create new element
- * @since Series S60 3.1
- * @param aType Element type id
- * @param aParentHandle Parent of the new element.
- * Note: Can be '0' if element is not added to DOM.
- * @param aDocumentHandle Document handle.
- * @param aRootHandle Root element handle.
- * @param aEngineHandle Element handle to be returned
- * @throws exception if not ok
- */
- virtual void CreateElementNsL(
- const TM2GSvgAttrType& aType,
- const TM2GSvgDocumentHandle& aDocumentHandle,
- TM2GSvgElementHandle& aEngineHandle) = 0;
-
- /**
- * Delete document
- * @since Series S60 3.1
- * @param aDocumentHandle Document handle
- * @throws exception if not ok
- */
- virtual void DeleteDocumentL(const TM2GSvgDocumentHandle& aDocumentHandle) = 0;
-
- /**
- * Delete svg engine
- * @since Series S60 3.1
- * @param aEngineHandle Engine handle
- * @throws exception if not ok
- */
- virtual void DeleteSvgEngineL(const TM2GSvgEngineHandle& aEngineHandle) = 0;
-
- /**
- * Deletes svg surface
- * @since Series S60 3.1
- * @param aSurfaceHandle Surface handle
- * @throws exception if not ok
- */
- virtual void DeleteSvgSurfaceL(const TM2GSvgDocumentHandle& aSurfaceHandle) = 0;
-
- /**
- * Delete path
- * @since Series S60 3.1
- * @param aPathHandle Path handle
- * @throws exception if not ok
- */
- virtual void DestroyPathL(const TM2GSvgPathHandle& aPathHandle) = 0;
-
- /**
- * Dispatches a mouse event
- * @since Series S60 3.1
- * @param aDocumentHandle Document handle.
- * @param aX X coordinate.
- * @param aY Y coordinate
- * @param aElementHandle Target element handle
- * @throws exception if not ok
- */
- virtual void DispatchMouseEventL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- TInt aX, TInt aY, TM2GSvgElementHandle& aElementHandle) = 0;
-
- /**
- * Set the end animation time for the given element.
- * @since Series S60 3.1
- * @param aDocumentHandle
- * @param aElementHandle
- * @param aOffset
- * @throws exception if not ok
- */
- virtual void EndElementAtL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- const TM2GSvgElementHandle& aElementHandle,
- const TReal32& aOffset) = 0;
-
-
- /**
- * Set focus on.
- * @since Series S60 3.1
- * @param aDocumentHandle
- * @param aElementHandle
- * @throws exception if not ok
- */
- virtual void FocusOnL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- const TM2GSvgElementHandle& aElementHandle) = 0;
-
- /**
- * Set focus out.
- * @since Series S60 3.1
- * @param aDocumentHandle
- * @param aElementHandle
- * @throws exception if not ok
- */
- virtual void FocusOutL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- const TM2GSvgElementHandle& aElementHandle) = 0;
-
- /**
- * Get a bounding box
- * @since Series S60 3.1
- * @param aElementHandle Element handle.
- * @param aAttributeType Attribute type
- * @param aRectData Rect components are saved to this parameter
- * @param aResult Result
- * @throws exception if not ok
- */
- virtual void GetBBoxL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgAttrType& aAttributeType,
- TM2GRectData& aRectData, TInt& aResult) = 0;
-
- /**
- * Get colors
- * @since Series S60 3.1
- * @param aElementHandle Element handle
- * @param aAttributeType Attribute type
- * @param aColor Result
- * @param aResult Extra result info
- * @throws exception if not ok
- */
- virtual void GetColorTraitL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgAttrType& aAttributeType,
- TM2GColorData& aColor,
- TInt& aResult) = 0;
-
- /**
- * Get element by id
- * @since Series S60 3.1
- * @param aDocumentHandle Document handle.
- * @param aId Element id
- * @param aElementHandle Element handle to be returned
- * @throws exception if not ok
- */
- virtual void GetElementByIdL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- const TPtrC16& aId,
- TM2GSvgElementHandle& aElementHandle) = 0;
-
- /**
- * Get element by id
- * @since Series S60 3.1
- * @param aElementHandle Element handle.
- * @param aId Result element type id.
- * @throws exception if not ok
- */
- virtual void GetElementTypeIdL(const TM2GSvgElementHandle& aElementHandle, TInt16& aId) = 0;
-
- /**
- * Get an enumeration value of the specified attribute.
- * @since Series S60 3.1
- * @param aElementHandle Element handle.
- * @param aAttributeType Attribute type
- * @param aEnumTraiT Enum attribute.
- * @throws exception if not ok
- */
- virtual void GetEnumTraitL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgAttrType& aAttributeType,
- TInt16& aEnumTrait) = 0;
-
- /**
- * Get external list item
- * @since Series S60 3.1
- * @param aDocumentHandle Document handle.
- * @param aIndex Index.
- * @param aItem Returns external item according to a given index
- * @return KErrNone if no error
- * @throws Exception if not ok
- */
- virtual TInt GetExternalListItemL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- TInt aIndex,
- TPtrC16& aItem) = 0;
-
- /**
- * Get external list size
- * @since Series S60 3.1
- * @param aDocumentHandle Document handle.
- * @param aListSz Size.
- * @throws exception if not ok
- */
- virtual void GetExternalListSizeL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- TInt& aListSz) = 0;
-
- /**
- * Get a first chlid element
- * @since Series S60 3.1
- * @param aElementHandle Element handle.
- * @param aChildHandle Returns child element handle.
- * @throws exception if not ok
- */
- virtual void GetFirstElementChildL(
- const TM2GSvgElementHandle& aElementHandle,
- TM2GSvgElementHandle& aChildHandle) = 0;
-
- /**
- * Get a float trait
- * @since Series S60 3.1
- * @param aElementHandle Element handle.
- * @param aAttributeType Attribute type
- * @param Float trait
- * @throws exception if not ok
- */
- virtual void GetFloatTraitL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgAttrType& aAttributeType,
- TReal32& aFloatTrait) = 0;
-
- /**
- * Get a matrix trait
- * @since Series S60 3.1
- * @param aElementHandle Element handle.
- * @param aAttributeType Attribute type
- * @param aMatrix Matrix trait
- * @param aResult
- * @throws exception if not ok
- */
- virtual void GetMatrixTraitL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgAttrType& aAttributeType,
- TM2GMatrixData& aMatrix, TInt& aResult) = 0;
-
- /**
- * Get a media time
- * @since Series S60 3.1
- * @param aDocumentHandle Document handle.
- * @param aSeconds Media time to be returned
- * @throws exception if not ok
- */
- virtual void GetMediaTimeL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- TReal32& aSeconds) = 0;
-
- /**
- * Get a next element sibling
- * @since Series S60 3.1
- * @param aElementHandle Element handle.
- * @param aSiblingElementHandle Sibling handle
- * @throws exception if not ok
- */
- virtual void GetNextElementSiblingL(
- const TM2GSvgElementHandle& aElementHandle,
- TM2GSvgElementHandle& aSiblingElementHandle) = 0;
-
- /**
- * Get the segment count for the given path.
- * @since Series S60 3.1
- * @param aPathHandle Path handle.
- * @param aNumberOfSegments Segment count
- * @throws exception if not ok
- */
- virtual void GetNumberOfSegmentsL(
- const TM2GSvgPathHandle& aPathHandle,
- TInt& aNumberOfSegments) = 0;
-
- /**
- * Get a parent
- * @since Series S60 3.1
- * @param aElementHandle Element handle.
- * @param aParentElementHandle Parent Element handle
- * @throws exception if not ok
- */
- virtual void GetParentL(
- const TM2GSvgElementHandle& aElementHandle,
- TM2GSvgElementHandle& aParentElementHandle) = 0;
-
- /**
- * Get a path trait
- * @since Series S60 3.1
- * @param aElementHandle Element handle.
- * @param aAttributeType Attribute type
- * @param aPathTrait Path trait
- * @throws exception if not ok
- */
- virtual void GetPathTraitL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgAttrType& aAttributeType,
- TInt& aPathTrait) = 0;
-
- /**
- * Get a rect trait
- * @since Series S60 3.1
- * @param aElementHandle Element handle.
- * @param aAttributeType Attribute type
- * @param aRectData Rect components are saved to this parameter
- * @param aResult Result
- * @throws exception if not ok
- */
- virtual void GetRectTraitL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgAttrType& aAttributeType,
- TM2GRectData& aRectData, TInt& aResult) = 0;
-
- /**
- * Get a root element
- * @since Series S60 3.1
- * @param aDocumentHandle Document handle.
- * @param aRootElementHandle Root element handle
- * @throws exception if not ok
- */
- virtual void GetRootElementL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- TM2GSvgElementHandle& aRootElementHandle) = 0;
-
- /**
- * Get screen b box
- * @since Series S60 3.1
- * @param aElementHandle Element handle
- * @param aScreenBBoxData Screen box data out
- * @throws exception if not ok
- */
- virtual void GetScreenBBoxL(
- const TM2GSvgElementHandle& aElementHandle,
- TM2GScreenBBoxData& aScreenBBoxData) = 0;
-
- /**
- * Get the segment parameter for the given path.
- * @since Series S60 3.1
- * @param aPathHandle Path handle.
- * @param aSegmentIndex -
- * @param aParamIndex -
- * @param aSegmentParam Segment parameter to be returned.
- * @throws exception if not ok
- */
- virtual void GetSegmentParameterL(
- const TM2GSvgPathHandle& aPathHandle,
- TInt aSegmentIndex, TInt aParamIndex,
- TReal32& aSegmentParam) = 0;
-
- /**
- * Get the segment type for the given path.
- * @since Series S60 3.1
- * @param aPathHandle Path handle.
- * @param aSegmentIndex -
- * @param aSegmentType Segment type
- * @throws exception if not ok
- */
- virtual void GetSegmentTypeL(
- const TM2GSvgPathHandle& aPathHandle,
- TInt aSegmentIndex,
- TInt16& aSegmentType) = 0;
-
- /**
- * Get a string trait
- * @since Series S60 3.1
- * @param aElementHandle Element handle.
- * @param aAttributeType Attribute type.
- * @param aStr Returns a string attribute
-
- * @throws exception if not ok
- */
- virtual TInt GetStringTraitL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgAttrType& aAttributeType,
- TPtrC16& aStr) = 0;
- /**
- * Get a svg surface height
- * @since Series S60 3.1
- * @param aSurfaceHandle Surface handle.
- * @return Svg surface height
- * @throws exception if not ok
- */
- virtual TInt GetSvgSurfaceHeightL(const TM2GBitmapHandle& aSurfaceHandle) = 0;
-
- /**
- * Get a svg surface width
- * @since Series S60 3.1
- * @param aSurfaceHandle Surface handle.
- * @return Svg surface width
- * @throws exception if not ok
- */
- virtual TInt GetSvgSurfaceWidthL(const TM2GBitmapHandle& aSurfaceHandle) = 0;
-
- /**
- * Finds handle to the actual cloned element
- * @since Series S60 3.1
- * @param aElementHandle Element handle.
- * @param aHandle Element handle to be returned
- * @throws exception if not ok
- */
- virtual void GetUsedFromElementL(
- const TM2GSvgElementHandle& aElementHandle,
- TM2GSvgElementHandle& aHandle) = 0;
-
- /**
- * Viewport height.
- * @since Series S60 3.1
- * @param aDocumentHandle Document handle.
- * @param aHeight Wieport height to be returned.
- * @throws exception if not ok
- */
- virtual void GetViewportHeightL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- TInt& aHeight) = 0;
-
- /**
- * Viewport width.
- * @since Series S60 3.1
- * @param aDocumentHandle Document handle.
- * @param aWidth Viewport width.
- * @throws exception if not ok
- */
- virtual void GetViewportWidthL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- TInt& aWidth) = 0;
-
- /**
- * Init native engine & document
- * @since Series S60 3.1
- * @param aDocumentHandle Document handle
- * @throws exception if not ok
- */
- virtual void InitViewportL(
- const TM2GSvgDocumentHandle& aDocumentHandle) = 0;
-
- /**
- * Add given child element to the given element before
- * the given reference element.
- * @since Series S60 3.1
- * @param aElementHandle Element handle.
- * @param aNewChildElementHandle Child element handle.
- * @param aReferenceElementHandle Child element handle.
- * @throws exception if not ok
- */
- virtual void InsertBeforeL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgElementHandle& aNewChildElementHandle,
- const TM2GSvgElementHandle& aReferenceElementHandle) = 0;
-
- /**
- * Check if element is active.
- * @since Series S60 3.1
- * @param aElementHandle Element handle.
- * @param aActive Return "1" if active
- * @throws exception if not ok
- */
- virtual void IsActiveL(
- const TM2GSvgElementHandle& aElementHandle,
- TInt& aActive) = 0;
-
- /**
- * Checks if an element in DOM.
- * @since Series S60 3.1
- * @param aDocumentHandle Document handle.
- * @param aElementHandle Element handle.
- * @param aIsElementInDom Result.
- * @throws exception if not ok
- */
- virtual void IsElementInDomL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- const TM2GSvgElementHandle& aElementHandle,
- TInt& aIsElementInDom) = 0;
-
- /**
- * Checks whether this element is child of a use element
- * @since Series S60 3.1
- * @param aElementHandle Element handle.
- * @param aResult Return "1" if used otherwise returns "0"
- * @throws exception if not ok
- */
- virtual void IsUsedL(
- const TM2GSvgElementHandle& aElementHandle,
- TInt& aResult) = 0;
-
- /**
- * Remove child
- * @since Series S60 3.1
- * @param aDocumentHandle Document handle.
- * @param aURI Uri
- * @param aResourceData Resource
- * @param aHandle Removed element handle
- * @throws exception if not ok
- */
- virtual void RemoveChildL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgElementHandle& aChildElementHandle,
- TM2GSvgElementHandle& aHandle) = 0;
- /**
- * Render document
- * @since Series S60 3.1
- * @param aEngineHandle Engine handle.
- * @param aDocumentHandle Document handle.
- * @param aSurfaceHandle Surface.
- * @param aSurfaceMaskHandle Mask.
- * @throws exception if not ok
- */
- virtual void RenderDocumentL(
- const TM2GSvgEngineHandle& aEngineHandle,
- const TM2GSvgDocumentHandle& aDocumentHandle,
- const TM2GBitmapHandle& aSurfaceHandle,
- TM2GBitmapHandle aSurfaceMaskHandle,
- TReal32 aCurrentTime) = 0;
-
-// pankaj Qimage related changes TODO following Changes done
- virtual void RenderDocumentL(
- const TM2GSvgEngineHandle& aEngineHandle,
- const TM2GSvgDocumentHandle& aDocumentHandle,
- const TM2GSvgBitmapHandle& aSurfaceHandle,
- TM2GSvgBitmapHandle aSurfaceMaskHandle,
- TReal32 aCurrentTime)=0;
-
- /**
- * Sets render quality
- * @since Series S60 3.1
- * @param aEngineHandle Engine handle.
- * @param aQuality Quality.
- * @throws exception if not ok
- */
- virtual void RenderQualityL(
- const TM2GSvgEngineHandle& aEngineHandle,
- TInt aQuality) = 0;
-
- /**
- * Request completed
- * @since Series S60 3.1
- * @param aDocumentHandle Document handle.
- * @param aURI -
- * @param aResourceData -
- * @param aCompeleted Result
- * @throws exception if not ok
- */
- virtual void RequestCompletedL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- const TPtrC16& aURI,
- const TPtrC8& aResourceData,
- TInt& aCompleted) = 0;
-
- /**
- * Set color trait
- * @since Series S60 3.1
- * @param aElementHandle Element handle.
- * @param aAttributeType Attribute type
- * @param aColor Color components: RGB
- * @throws exception if not ok
- */
- virtual void SetColorTraitL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgAttrType& aAttributeType,
- const TM2GColorData& aColor) = 0;
-
- /**
- * Set enum trait
- * @since Series S60 3.1
- * @param aElementHandle Element handle.
- * @param aAttributeType Attribute type
- * @param aValue Value
- * @throws exception if not ok
- */
- virtual void SetEnumTraitL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgAttrType& aAttributeType,
- TInt16 aValue) = 0;
-
- /**
- * Set float attribute
- * @since Series S60 3.1
- * @param aElementHandle Element handle.
- * @param aAttributeType Attribute type
- * @param aValue Value
- * @throws exception if not ok
- */
- virtual void SetFloatTraitL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgAttrType& aAttributeType,
- const TReal32& aValue) = 0;
-
- /**
- * Set matrix attribute
- * @since Series S60 3.1
- * @param aElementHandle Element handle.
- * @param aAttributeType Attribute type
- * @param aMatrix -
- * @throws exception if not ok
- */
- virtual void SetMatrixTraitL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgAttrType& aAttributeType,
- const TM2GMatrixData& aMatrix) = 0;
-
- /**
- * Set media time
- * @since Series S60 3.1
- * @param aDocumentHandle Document handle.
- * @param aSeconds Media time
- * @throws exception if not ok
- */
- virtual void SetMediaTimeL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- const TReal32& aSeconds) = 0;
-
- /**
- * Set path attribute
- * @since Series S60 3.1
- * @param aElementHandle Element handle.
- * @param aAttributeType Attribute type
- * @param aPathHandle -
- * @throws exception if not ok
- */
- virtual void SetPathTraitL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgAttrType& aAttributeType,
- const TM2GSvgPathHandle& aPathHandle) = 0;
-
- /**
- * Set rect attribute
- * @since Series S60 3.1
- * @param aElementHandle Element handle.
- * @param aAttributeType Attribute type
- * @param aRect Rect trait to be set
- * @throws exception if not ok
- */
- virtual void SetRectTraitL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgAttrType& aAttributeType,
- const TM2GRectData& aRect) = 0;
-
- /**
- * Set render quality
- * @since Series S60 3.1
- * @param aEngineHandle Engine handle.
- * @param aMode
- * @throws exception if not ok
- */
- virtual void SetRenderingQualityL(
- const TM2GSvgEngineHandle& aEngineHandle,
- TInt aMode) = 0;
-
- /**
- * Set string attribute
- * @since Series S60 3.1
- * @param aElementHandle Element handle.
- * @param aAttributeType Attribute type
- * @param aStr String trait to be set
- * @throws exception if not ok
- */
- virtual void SetStringTraitL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgAttrType& aAttributeTypeId,
- const TPtrC16& aStr) = 0;
-
- /**
- * Set viewport height
- * @since Series S60 3.1
- * @param aDocumentHandle Document
- * @param aWidth Width
- * @throws exception if not ok
- */
- virtual void SetViewportHeightL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- TInt aHeight) = 0;
-
- /**
- * Set viewport width
- * @since Series S60 3.1
- * @param aDocumentHandle Document
- * @param aWidth Width
- * @throws exception if not ok
- */
- virtual void SetViewportWidthL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- TInt aWidth) = 0;
-};
-
-M2G_NS_END
-
-#endif // MM2GSVGPROXY_H
--- a/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/ESWTScalableGraphics.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-package com.nokia.microedition.m2g;
-
-import javax.microedition.m2g.ScalableGraphics;
-import javax.microedition.m2g.ScalableImage;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.*;
-
-public class ESWTScalableGraphics
-{
- Display iDisplay = null;
- Rectangle iCanvasBounds = null;
- ScalableGraphics iSg = null;
- GC iBufferGC = null;
- GC iRealGC = null;
- Image iBufferedImage = null;
-
- public ESWTScalableGraphics(Display display)
- {
- System.out.println("P+ ESWTScalableGraphics(Display display)");
-
- iSg = ScalableGraphics.createInstance();
- iDisplay = display;
- }
-
- public ESWTScalableGraphics(Display display, Rectangle canvasBounds)
- {
- System.out.println(" P+ ESWTScalableGraphics(Display display, Rectangle canvasBounds)");
- iSg = ScalableGraphics.createInstance();
- iDisplay = display;
- iCanvasBounds = canvasBounds;
- }
-
- public void setBounds(Rectangle canvasBounds)
- {
- iCanvasBounds = canvasBounds;
- }
-
- public void bindTarget(GC gc)
- {
- System.out.println(" bindTarget(GC gc)");
- iRealGC = gc;
- iBufferedImage = new Image(iDisplay, iCanvasBounds);
- iBufferGC = new GC(iBufferedImage);
- iSg.bindTarget(iBufferGC);
- }
-
- public void releaseTarget()
- {
- System.out.println(" releaseTarget");
-
- iSg.releaseTarget();
- iBufferedImage.dispose();
- iBufferGC.dispose();
- /* iRealGC is disposed in paintControl */
- iRealGC = null;
- }
-
- public void render(int x, int y, ScalableImage image)
- {
- System.out.println(" render(int x, int y, ScalableImage image)");
- iSg.render(x,y, image);
- iRealGC.drawImage(iBufferedImage, x, y);
- }
-
- public void setRenderingQuality(int mode)
- {
- System.out.println("setRenderingQuality(int mode)");
- iSg.setRenderingQuality(mode);
- }
-
- public void setTransparency(float alpha)
- {
- System.out.println("setTransparency(float alpha)");
- iSg.setTransparency(alpha);
- }
-}
--- a/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/M2GDOMChangeObserver.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*
-* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-package com.nokia.microedition.m2g;
-
-/**
- * Anyone implementing this interface will receive notifications
- * about changes in DOM.
- * <br>
- * Subject = M2GDocument
- * Observer/listener = M2GSVGCanvas
- * <br>
- * M2GSVGCanvas from M2GSVGAnimator implements this in order to be notified
- * about changes in DOM, so that SVGImage updates
- * (via the API, e.g. setTrait(), insertBefore()) will be rendered
- * while Animator is in pause state.
- * <br>
- * M2GSVGElement informs M2GDocument about changes in DOM
- * (e.g. adding/removing nodes, changing traits),
- * and then M2GDocument informs M2GSVGCanvas.
- * <br>
- * @since S60 3.2
- */
-public interface M2GDOMChangeObserver
-{
- /**
- * Notifies about any change in DOM
- */
- public void notifyDOMChange();
-}
--- a/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/M2GDestroyable.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-package com.nokia.microedition.m2g;
-
-//import com.nokia.mj.impl.rt.legacy.ToolkitInvoker;
-//import com.nokia.mj.impl.rt.legacy.ToolkitObserver;
-
-/**
- * Interface
- */
-public interface M2GDestroyable
-{
- /**
- * Finalization
- */
- void doDestroy();
-}
-
-//--------------------------------------------------
-// OTHER CLASSES
-//--------------------------------------------------
-/**
- * M2GDestroyer implements the ToolkitObserver interface.
- */
-class M2GDestroyer
-{
- private M2GDestroyable iDestroyable;
-
- /**
- * Ctor
- * @param aDestroyable Destroy target
- */
- M2GDestroyer(M2GDestroyable aDestroyable)
- {
- if (aDestroyable != null)
- {
- iDestroyable = aDestroyable;
- }
- }
-}
-
-
--- a/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/M2GDocument.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1339 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-package com.nokia.microedition.m2g;
-
-import org.w3c.dom.*;
-import org.w3c.dom.events.*;
-import org.w3c.dom.svg.SVGElement;
-import java.io.IOException;
-import java.util.Hashtable;
-import java.lang.ref.WeakReference;
-import java.util.Vector;
-import java.util.Enumeration;
-import javax.microedition.m2g.*;
-import com.nokia.microedition.m2g.connection.*;
-import com.nokia.mj.impl.utils.Logger;
-
-public class M2GDocument extends M2GObject
- implements Document, M2GConnectionPolicyHandler
-{
- //--------------------------------------------------
- // STATIC CONSTANTS
- //--------------------------------------------------
- // Error constants
- /* Optimization: static finals changed to local variables
- public static final String UNSUPORTED_ELEMENT_TYPE_ESTR =
- "The type of element is not supported by the implementation.";
- public static final String UNSUPORTED_NAMESPACE_ESTR =
- "The URI is not the SVG namespace URI.";
- public static final String ID_IS_NULL_ESTR =
- "The ID is null.";
- public static final String NAMESPACE_URI_IS_NULL_ESTR =
- "The namespace URI is null.";
- public static final String QUALIFIED_NAME_IS_NULL_ESTR =
- "The qualifiedName is null.";
- public static final String CANNOT_APPEND_CHILD_ESTR =
- "Cannot appendChild to a Document node.";
- public static final String CANNOT_INSERT_BEFORE_ESTR =
- "Cannot insertBefore a Document node.";
- public static final String CANNOT_REMOVE_CHILD_ESTR =
- "Cannot removeChild from a Document node.";
- public static final String DOCUMENT_IS_ILLEGAL_ESTR =
- "The SVG document does not conform to the XML 1.0 specification.";
- public static final String HEIGHT_IS_ILLEGAL_ESTR =
- "The height is negative.";
- public static final String WIDTH_IS_ILLEGAL_ESTR =
- "The width is negative.";
- */
-
- //--------------------------------------------------
- // VARIABLES
- //--------------------------------------------------
- private M2GEventDispatcher iEventDispatcher = null;
- private ExternalResourceHandler iResourceHandler = null;
- private M2GSVGImage iImage = null;
- private M2GSVGSVGElement iRootElement = null;
- private final M2GLiveElements iLiveElements = new M2GLiveElements(true);
- private M2GConnectionPolicy iConnectionPolicy =
- M2GConnectionFactory.getDefaultPolicy();
- boolean iConnectionRight = true;
- Vector iExternalResources = new Vector();
-
- /** A base url from where a document was downloaded */
- String iBaseUrl;
-
- /** The suffix of the url from where the document was open*/
- String iSuffixUrl;
-
- /**
- * Observer to be notified about changes in DOM
- * @see M2GDOMChangeObserver.notifyDOMChange()
- */
- private M2GDOMChangeObserver iDOMChangeObserver = null;
-
- //--------------------------------------------------
- // METHODS
- //--------------------------------------------------
- /**
- * Creates new document object. If aData is null or empty then
- * an empty document is create.
- * @param aImage Svg image
- * @param aBaseUrl A base url from where a document is downloaded.
- * @param aSuffixUrl A suffix url from where a document is downloaded
- * @param aData Plain text svg data
- */
- public M2GDocument(M2GSVGImage aImage, String aBaseUrl, String aSuffixUrl,
- String aData)
- {
- super();
-
- System.out.println("P-M2GDocument Constructor getting Called.");
- iImage = aImage;
- iBaseUrl = aBaseUrl;
- iSuffixUrl = aSuffixUrl;
-
- setHandle(_createDocument(
- getNativeSVGProxyHandle(),
- aData)
- );
-
- doConstruct();
- }
-
- /**
- * @see org.w3c.dom.Node#appendChild()
- */
- public Node appendChild(Node newChild) throws DOMException
- {
- // Optimization: if(!getConnectionPolicy().getAccessRight())
- if (!iConnectionRight)
- {
- Logger.ELOG(Logger.EJavaUI, "appendChild() - access rights failure");
- throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
- }
- Logger.ELOG(Logger.EJavaUI, "appendChild() - exception: "
- + /*SF*/"Cannot appendChild to a Document node."/*SF*/);
- throw new DOMException(
- DOMException.HIERARCHY_REQUEST_ERR,
- /*SF*/"Cannot appendChild to a Document node."/*SF*/);
- }
-
- /**
- * Appends external resource uri to internal container
- * @param aUri External resource uri
- * @return true if succeeds
- */
- boolean appendExternalResourceURI(String aUri)
- {
- boolean result = false;
- if (aUri != null && !aUri.equals(""))
- {
- synchronized (iExternalResources)
- {
- if (!iExternalResources.contains(aUri))
- {
- iExternalResources.addElement(aUri);
- result = true;
- }
- }
- }
- Logger.LOG(Logger.EJavaUI, Logger.EInfo, "appendExternalResourceURI() uri=" +
- ((aUri != null) ? aUri : "null") + ", result=" + result + " - end");
- return result;
- }
-
- /**
- * Checks if document contains the element
- * @param id
- * @return true if document contains the element
- */
- public boolean containsElement(String id)
- {
- if (id == null || id.equals(""))
- {
- return false;
- }
- int handle = _getElementById(
- getNativeSVGProxyHandle(),
- getHandle(), id);
- return M2GObject.checkHandle(handle);
- }
-
- /**
- * Check if external resource uri exists in internal container
- * @param aUri External resource uri
- * @return true if uri exists in container
- */
- boolean containsExternalResourceURI(String aUri)
- {
- boolean result = false;
- if (aUri != null && !aUri.equals(""))
- {
- synchronized (iExternalResources)
- {
- result = iExternalResources.contains(aUri);
- }
- }
- Logger.LOG(Logger.EJavaUI, Logger.EInfo, "containsExternalResourceURI() uri=" +
- ((aUri != null) ? aUri : "null") + ", result=" + result + " - end");
- return result;
- }
-
-
- /**
- * @see org.w3c.dom.Document#createElementNS()
- */
- public Element createElementNS(String namespaceURI, String qualifiedName)
- {
- if (namespaceURI == null || namespaceURI.equals(""))
- {
- Logger.ELOG(Logger.EJavaUI,
- "createElementNS() exception because namespace is null. qualifiedName="
- + qualifiedName);
- throw new NullPointerException(/*SF*/"The namespace URI is null."/*SF*/);
- }
- if (qualifiedName == null || qualifiedName.equals(""))
- {
- Logger.ELOG(Logger.EJavaUI,
- "createElementNS() exception - " + namespaceURI + ", "
- + qualifiedName);
- throw new NullPointerException(/*SF*/"The qualifiedName is null."/*SF*/);
- }
- // Checks element validity
- if (!M2GSVGConstants.isQualifiedElement(qualifiedName))
- {
- Logger.ELOG(Logger.EJavaUI, "createElementNS() exception - "
- + namespaceURI + ", " + qualifiedName);
- throw new DOMException(
- DOMException.NOT_SUPPORTED_ERR,
- /*SF*/"The type of element is not supported by the implementation."/*SF*/);
- }
- // Checks namespace validity
- if (!namespaceURI.equals(M2GSVGConstants.SVG_NAMESPACE_URI))
- {
- Logger.ELOG(Logger.EJavaUI, "createElementNS() exception - "
- + namespaceURI + ", " + qualifiedName);
- throw new DOMException(
- DOMException.NOT_SUPPORTED_ERR,
- /*SF*/"The URI is not the SVG namespace URI."/*SF*/);
- }
- // Creates native element. A native document owns the new element.
- // NOTE: The element is NOT located in the DOM tree yet.
- int elementHandle = _createElementNS(
- getNativeSVGProxyHandle(),
- M2GSVGConstants.parseElementTypeId(qualifiedName),
- getHandle());
- M2GSVGLocatableElement element = null;
- // Checks native handle validity
- if (M2GObject.checkHandle(elementHandle))
- {
- // Creates java element object
- element = new M2GSVGLocatableElement(elementHandle, this);
- registerLiveElement(element, new Integer(elementHandle));
- }
- else
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "createElementNS(): " + qualifiedName + " - end, NOK!!!");
- }
- return element;
- }
-
- /**
- * Checks document validity.
- * @return true if valid
- */
- public boolean doCheckValidity() throws IOException
- {
- boolean result = false;
- if (isHandleValid())
- {
- M2GSVGSVGElement root = getRootElement();
- if (root != null)
- {
- // Check svg version and base profile
- root.checkVersionAndProfile();
- result = true;
- }
- }
- return result;
- }
-
- /**
- * Cleanup
- * @see com.nokia.microedition.m2g.M2GObject#doCleanup()
- */
- public void doCleanup()
- {
- if (isHandleValid())
- {
- _deleteDocument(
- getNativeSVGProxyHandle(),
- getHandle());
- }
- iImage = null;
- if (iEventDispatcher != null)
- {
- iEventDispatcher.clear();
- iEventDispatcher = null;
- }
- resetHandles();
- }
-
- /**
- * @see com.nokia.microedition.m2g.M2GObject#doConstruct()
- */
- protected void doConstruct()
- {
- super.doConstruct();
- iEventDispatcher = new M2GEventDispatcher();
- }
-
- /**
- * Find an element from the handle-to-element map.
- * @see M2GLiveElements#findElement()
- */
- public SVGElement findLiveElement(Integer aElementHandle)
- {
- return iLiveElements.findElement(aElementHandle);
- }
-
- /**
- * Get connection policy
- * @see M2GConnectionListener#getConnectionPolicy()
- */
- public M2GConnectionPolicy getConnectionPolicy()
- {
- return iConnectionPolicy;
- }
-
- /**
- * @see org.w3c.dom.Document#getDocumentElement()
- */
- public Element getDocumentElement()
- {
- // Optimization: if(!getConnectionPolicy().getAccessRight())
- if (!iConnectionRight)
- {
- Logger.ELOG(Logger.EJavaUI,
- "getDocumentElement() - access rights failure");
- throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
- }
- return getRootElement();
- }
-
- /**
- * @see org.w3c.dom.Document#getElementById()
- */
- public Element getElementById(String id)
- {
- // Optimization: if(!getConnectionPolicy().getAccessRight())
- if (!iConnectionRight)
- {
- Logger.ELOG(Logger.EJavaUI, "getElementById() - access rights failure");
- throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
- }
- if (id == null || id.equals(""))
- {
- Logger.ELOG(Logger.EJavaUI, "getElementById() - exception");
- throw new NullPointerException(/*SF*/"The ID is null."/*SF*/);
- }
- int elementHandle = _getElementById(
- getNativeSVGProxyHandle(),
- getHandle(),
- id );
- return M2GSVGElement.buildElement(elementHandle, this);
- }
-
- /**
- * Returns the image
- */
- public M2GSVGImage getImage()
- {
- return iImage;
- }
-
- /**
- * @see org.w3c.dom.Node#getLocalName()
- */
- public String getLocalName()
- {
- // Optimization: if(!getConnectionPolicy().getAccessRight())
- if (!iConnectionRight)
- {
- Logger.ELOG(Logger.EJavaUI, "getLocalName() - access rights failure");
- throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
- }
- return null;
- }
-
- /**
- * @see org.w3c.dom.Node#getNamespaceURI()
- */
- public String getNamespaceURI()
- {
- // Optimization: if(!getConnectionPolicy().getAccessRight())
- if (!iConnectionRight)
- {
- Logger.ELOG(Logger.EJavaUI, "getNamespaceURI() - access rights failure");
- throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
- }
- return null;
- }
-
- /**
- * @see org.w3c.dom.Node#getParentNode()
- */
- public Node getParentNode()
- {
- // Optimization: if(!getConnectionPolicy().getAccessRight())
- if (!iConnectionRight)
- {
- Logger.ELOG(Logger.EJavaUI,
- "getParentNode() - access rights failure");
- throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
- }
- return null;
- }
-
- /**
- * Get root element
- * @return M2GSVGSVGElement
- */
- public M2GSVGSVGElement getRootElement()
- {
- if (iRootElement == null)
- {
- iRootElement = M2GSVGSVGElement.buildRootElement(this);
- }
- return iRootElement;
- }
-
- /**
- * @see javax.microedition.m2g.ScalableImage#getViewportHeight()
- */
- public int getViewportHeight()
- {
- return _getViewportHeight(
- getNativeSVGProxyHandle(),
- getHandle());
- }
-
- /**
- * @see javax.microedition.m2g.ScalableImage#getViewportWidth()
- */
- public int getViewportWidth()
- {
- return _getViewportWidth(
- getNativeSVGProxyHandle(),
- getHandle() );
- }
-
-
- /**
- * Called by SVGImage upon creating an Event instance
- * Calls the handleEvent() of all the listeners of the event
- */
- public void handleEvent(Event aEvent)
- {
- iEventDispatcher.handleEvent(aEvent);
- }
-
- /**
- * @see org.w3c.dom.Node#insertBefore()
- */
- public Node insertBefore(Node newChild, Node refChild)
- {
- // Optimization: if(!getConnectionPolicy().getAccessRight())
- if (!iConnectionRight)
- {
- Logger.ELOG(Logger.EJavaUI, "insertBefore() - access rights failure");
- throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
- }
-
- Logger.ELOG(Logger.EJavaUI, "insertBefore() DOMException");
- throw new DOMException(
- DOMException.HIERARCHY_REQUEST_ERR,
- /*SF*/"Cannot insertBefore a Document node."/*SF*/);
- }
-
- /**
- * Checks if element is in DOM
- * @param aElementHandle -
- * @return true if element is in DOM
- */
- public boolean isElementInDOM(int aElementHandle)
- {
- if (!M2GObject.checkHandle(aElementHandle))
- {
- return false;
- }
- return (_isElementInDOM(
- getNativeSVGProxyHandle(),
- getHandle(),
- aElementHandle) > 0 ? true : false);
- }
-
- /**
- * The external resource handler is invoked
- * for any external resource referenced in the document.
- * @param aUri External resource referenced in the document
- */
- public void invokeResourceHandler(String aUri)
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo, "invokeResourceHandler() - URI="
- + aUri + " - begin");
-
- if ((iImage != null) && (iResourceHandler != null) &&
- (aUri != null) && (aUri.length() > 4))
- {
- StringBuffer urlBuf = new StringBuffer();
- // The uri format for external resource must include the base url
- // from which the document was loaded. It's also checked that the
- // url read from svg doesn't contain already the base part.
- if ((iBaseUrl != null) &&
- !iBaseUrl.equals("") &&
- (aUri.indexOf(iBaseUrl) == -1))
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "invokeResourceHandler() append base url=" + iBaseUrl);
- urlBuf.append(iBaseUrl);
- }
-
- urlBuf.append(aUri);
-
- // append the url suffix in case of drm open mode
- if (iSuffixUrl != null && !iSuffixUrl.equals(""))
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "invokeResourceHandler() append suffix url=" + iSuffixUrl);
- urlBuf.append(iSuffixUrl);
- }
-
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "invokeResourceHandler() handler uri=" + urlBuf.toString());
-
- iResourceHandler.requestResource(iImage, urlBuf.toString());
- appendExternalResourceURI(aUri);
- }
-
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "invokeResourceHandler() - URI:" + aUri + " - end");
- }
-
- /**
- * Registers an event target and an event listener.
- * @param aTarget Target element
- * @param aType Event type
- * @param aListener Event listener
- */
- void register(EventTarget aTarget, String aType, EventListener aListener)
- {
- iEventDispatcher.register(aTarget, aType, aListener);
- }
-
- /**
- * Register element
- * @see M2GLiveElements#registerElement()
- */
- public void registerLiveElement(SVGElement aElement, Integer aElementHandle)
- {
- iLiveElements.registerElement(aElement, aElementHandle);
- }
-
- /**
- * @see org.w3c.dom.Node#removeChild()
- */
- public Node removeChild(Node oldChild) throws DOMException
- {
- // Optimization: if(!getConnectionPolicy().getAccessRight())
- if (!iConnectionRight)
- {
- Logger.ELOG(Logger.EJavaUI, "removeChild() - access rights failure");
- throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
- }
- Logger.ELOG(Logger.EJavaUI, "removeChild() DOMException");
- throw new DOMException(
- DOMException.NOT_SUPPORTED_ERR,
- /*SF*/"Cannot removeChild from a Document node."/*SF*/);
- }
-
- /**
- * Removes external resource uri from internal container
- * @param aUri External resource uri
- * @return true if succeeds
- */
- boolean removeExternalResourceURI(String aUri)
- {
- boolean result = false;
- if (aUri != null && !aUri.equals(""))
- {
- synchronized (iExternalResources)
- {
- result = iExternalResources.removeElement(aUri);
- }
- }
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "removeExternalResourceURI() uri="
- + ((aUri != null) ? aUri : "null") + ", result=" + result + " - end");
- return result;
- }
-
- /*
- * @see com.nokia.microedition.m2g.M2GSVGImage#requestCompleted()
- */
- public int requestCompleted(String aUri, byte[] aResourceData)
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "requestCompleted() uri=" + aUri + " - begin");
- // If the aUri contains a base part it will be cut off
- if (!aUri.equals("") &&
- (iBaseUrl != null) &&
- !containsExternalResourceURI(aUri) &&
- (aUri.indexOf(iBaseUrl, 0) != -1))
- {
- aUri = aUri.substring(iBaseUrl.length(), aUri.length());
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "requestCompleted() uri when base part is cut off=" + aUri);
- }
-
- // Execute tha request command.
- int status = _requestCompleted(
- getNativeSVGProxyHandle(),
- getHandle(), aUri, aResourceData);
- if ((status == 0) || aUri.equals(""))
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "requestCompleted() remove URI=" + aUri);
- removeExternalResourceURI(aUri);
- }
- return status;
- }
-
- /**
- * Set connection policy
- * @see M2GConnectionListener#setConnectionPolicy()
- */
- public void setConnectionPolicy(M2GConnectionPolicy aConnectionPolicy)
- {
- iConnectionPolicy = aConnectionPolicy;
- if (iConnectionPolicy != null)
- {
- iConnectionRight = iConnectionPolicy.getAccessRight();
- }
- else
- {
- iConnectionRight = true;
- }
- }
-
- /**
- * Set image
- * @param aImage Image
- */
- public void setImage(M2GSVGImage aImage)
- {
- iImage = aImage;
- }
-
- /**
- * Set external resource handler
- * @param aHandler External resource handler
- */
- public void setResourceHandler(ExternalResourceHandler aHandler)
- {
- iResourceHandler = aHandler;
- }
-
- /**
- * @see javax.microedition.m2g.ScalableImage#setViewportHeight()
- */
- public void setViewportHeight(int height)
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "setViewportHeight():" + height + " - begin");
- if (height < 0)
- {
- Logger.ELOG(Logger.EJavaUI, "setViewportHeight():"
- + height + " - IllegalArgumentException is thrown");
- throw new IllegalArgumentException(/*SF*/"The height is negative."/*SF*/);
- }
- _setViewportHeight(
- getNativeSVGProxyHandle(),
- getHandle(),
- height);
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "setViewportHeight():" + height + " - end");
- }
-
- /**
- * @see javax.microedition.m2g.ScalableImage#setViewportWidth()
- */
- public void setViewportWidth(int width)
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo, "setViewportWidth:" + width + " - begin");
- if (width < 0)
- {
- Logger.ELOG(Logger.EJavaUI, "setViewportWidth():"
- + width + " - IllegalArgumentException is thrown");
- throw new IllegalArgumentException(/*SF*/"The width is negative."/*SF*/);
- }
- _setViewportWidth(
- getNativeSVGProxyHandle(),
- getHandle(),
- width );
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "setViewportWidth:" + width + " - end");
- }
-
- /**
- * Unregister event listener
- * @param aTarget Target element
- * @param aType Event type
- * @param aListener Event listener
- */
- void unregister(EventTarget aTarget, String aType, EventListener aListener)
- {
- iEventDispatcher.unregister(aTarget, aType, aListener);
- }
-
- /**
- * Unregister an element from the handle-to-element map
- * @see M2GLiveElements#unregisterElement()
- */
- public void unregisterLiveElement(Integer aElementHandle)
- {
- iLiveElements.unregisterElement(aElementHandle);
- }
-
- //--------------------------------------------------
- // INNER CLASSES
- //--------------------------------------------------
- /**
- * M2GLiveElements
- */
- class M2GLiveElements
- {
- private Hashtable iLiveElements = new Hashtable();
- private boolean iUseWeakReference;
-
- /**
- * Constructor
- */
- public M2GLiveElements(boolean aUseWeakReference)
- {
- iUseWeakReference = aUseWeakReference;
- }
-
- /**
- * Find an element from the handle-to-element map.
- * @param aElementHandle Handle
- * @return SVGElement. Null if not found
- */
- public SVGElement findElement(Integer aElementHandle)
- {
- SVGElement element = null;
- Object weakObject = null;
- Object object = null;
-
- synchronized (this)
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "** findElement() handle: " + aElementHandle + " - begin **");
- object = iLiveElements.get(aElementHandle);
- if (object != null)
- {
- if (iUseWeakReference)
- {
- weakObject = ((WeakReference)object).get();
- if (weakObject == null)
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "** findElement() handle: " + aElementHandle
- + " is garbage collected. **");
- iLiveElements.remove(aElementHandle);
- }
- else
- {
- element = (SVGElement)weakObject;
- }
- }
- else
- {
- element = (SVGElement)object;
- }
- }
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,"** findElement() handle: " + aElementHandle
- + ((element != null) ? " FOUND" : " NOT FOUND") + " - end **");
- }
- return element;
- }
-
- /**
- * Register element
- * @param aElement Element
- * @param aElementHandle Handle
- */
- public void registerElement(SVGElement aElement, Integer aElementHandle)
- {
- if (aElement == null)
- {
- return;
- }
- synchronized (this)
- {
- if (iUseWeakReference)
- {
- iLiveElements.put(aElementHandle, new WeakReference(aElement));
- }
- else
- {
- iLiveElements.put(aElementHandle, aElement);
- }
- }
- }
-
- /**
- * Unregister an element from the handle-to-element map
- * @param aElementHandle Handle
- */
- public void unregisterElement(Integer aElementHandle)
- {
- synchronized (this)
- {
- iLiveElements.remove(aElementHandle);
- }
- }
- }
-
-
- /**
- * M2GEventDispatcher
- */
- protected class M2GEventDispatcher
- {
- static public final int INDEX_UNDEFINED = -1;
- static public final int INDEX_CLICK = 0;
- static public final int INDEX_ACTIVATE = 1;
- static public final int INDEX_FOCUS_IN = 2;
- static public final int INDEX_FOCUS_OUT = 3;
-
- Hashtable[] iEventTypes;
- int iCurrentIndex;
- Hashtable iDelayedRegistrations = new Hashtable();
- M2GEventData iCurrentEventData = new M2GEventData();
-
- /**
- * Constructor
- */
- public M2GEventDispatcher()
- {
- iEventTypes = new Hashtable[4];
- iCurrentIndex = INDEX_UNDEFINED;
- }
-
- /**
- * Clear all
- */
- public void clear()
- {
- synchronized (this)
- {
- for (int index = 0; index < iEventTypes.length; index++)
- {
- if (iEventTypes[index] != null)
- {
- iEventTypes[index].clear();
- iEventTypes[index] = null;
- }
- }
- }
- }
-
- /**
- * Execute delayed registration
- * If an EventListener is added to an EventTarget while it is
- * processing an event, it will not be triggered by the current actions.
- */
- private void doDelayedRegistration()
- {
- try
- {
- Enumeration registrations = iDelayedRegistrations.elements();
- while (registrations.hasMoreElements())
- {
- M2GEventData eventData =
- (M2GEventData)registrations.nextElement();
- register(
- eventData.iTarget, eventData.iType, eventData.iListener);
- }
- }
- catch (NullPointerException e)
- {
- }
- iDelayedRegistrations.clear();
- }
-
-
- /**
- * Handle event
- * @param aEvent Event
- */
- public void handleEvent(Event aEvent)
- {
- synchronized (this)
- {
- if ((aEvent == null) || !prepare(aEvent.getType()))
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "handleEvent() FAILED - event invalid");
- return;
- }
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "handleEvent(): " + aEvent.getType() + " - begin");
- EventTarget target = aEvent.getCurrentTarget();
- if (target == null)
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "handleEvent() FAILED - event's target is null");
- return;
- }
- // Check if wrapped event target
- if (target instanceof M2GSVGElementWrapper)
- {
- target = ((M2GSVGElementWrapper)target).getWrappedTarget();
- if (target == null)
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "handleEvent() FAILED - wrapped event's target is null");
- return;
- }
- }
- if (iEventTypes[iCurrentIndex].containsKey(target))
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "handleEvent() - target handling begin");
- iCurrentEventData.set(target, aEvent.getType(), null);
- Vector listeners =
- (Vector)iEventTypes[iCurrentIndex].get(iCurrentEventData.iTarget);
-
- if (listeners != null)
- {
- Enumeration index = listeners.elements();
- while (index.hasMoreElements())
- {
- Object listener = index.nextElement();
- if ((listener != null) && (listener instanceof EventListener))
- {
- ((EventListener)listener).handleEvent(aEvent);
- }
- else
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "handleEvent(): listener is null!");
- }
- }
- }
- else
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "handleEvent(): listeners is null!");
- }
- iCurrentEventData.clear();
- }
- else
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "handleEvent(): target not found");
- }
- // Execute the delayed registration.
- doDelayedRegistration();
- }
- }
-
- /**
- * Check is event targets are equal
- * @param aLhs Left hand side
- * @param aRhs Right hand side
- * @return True if equal
- */
- private boolean isEquals(EventTarget aLhs, EventTarget aRhs)
- {
- int lhsHandle = M2GObject.INVALID_NATIVE_HANDLE;
- int rhsHandle = M2GObject.INVALID_NATIVE_HANDLE;
- if (aLhs instanceof M2GSVGElement)
- {
- lhsHandle = ((M2GSVGElement)aLhs).getHandle();
- }
- if (aRhs instanceof M2GSVGElement)
- {
- rhsHandle = ((M2GSVGElement)aRhs).getHandle();
- }
- if ((lhsHandle == rhsHandle) && (lhsHandle != M2GObject.INVALID_NATIVE_HANDLE))
- {
- return true;
- }
- return false;
- }
-
- /**
- * Set an index that points to an event type hash table.
- * The hash table is created if needed.
- * @param aType Type
- */
- private boolean prepare(String aType)
- {
- if (!setIndex(aType))
- {
- return false;
- }
- if (iEventTypes[iCurrentIndex] == null)
- {
- iEventTypes[iCurrentIndex] = new Hashtable();
- }
- return true;
- }
-
- /**
- * Register an event target and an event listener pair
- * @param aTarget Target
- * @param aType Type
- * @param aListener Listener
- */
- public void register(EventTarget aTarget,
- String aType,
- EventListener aListener)
- {
- // NOTE: no need to check validity of aTarget & aListener. It's
- // already done.
- synchronized (this)
- {
- if (!prepare(aType))
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "register() - failed: " + aType);
- return;
- }
- // Check if delayed registration is needed
- // If an EventListener is added to an EventTarget while it is
- // processing an event, it will not be triggered by
- // the current actions.
- if ((iCurrentEventData.iType == aType) &&
- isEquals(iCurrentEventData.iTarget, aTarget))
- {
- try
- {
- iDelayedRegistrations.put(
- aListener,
- new M2GEventData(aTarget, aType, aListener));
- }
- catch (NullPointerException e)
- {
- }
- return;
- }
- Vector listeners = null;
- if (iEventTypes[iCurrentIndex].containsKey(aTarget))
- {
- listeners = (Vector)iEventTypes[iCurrentIndex].get(aTarget);
- }
- else
- {
- listeners = new Vector();
- iEventTypes[iCurrentIndex].put(aTarget, listeners);
- }
- // Don't add if the event target already contains the same listener
- // for the same event.
- if (!listeners.contains(aListener))
- {
- listeners.addElement(aListener);
- }
- }
- }
-
- /**
- * Set an event type container index
- * @param aType Type
- * @return False if the type is invalid
- */
- private boolean setIndex(String aType)
- {
- if (aType.equals(M2GSVGConstants.EVENT_ACTIVATE))
- {
- iCurrentIndex = INDEX_ACTIVATE;
- }
- else if (aType.equals(M2GSVGConstants.EVENT_CLICK))
- {
- iCurrentIndex = INDEX_CLICK;
- }
- else if (aType.equals(M2GSVGConstants.EVENT_FOCUS_IN))
- {
- iCurrentIndex = INDEX_FOCUS_IN;
- }
- else if (aType.equals(M2GSVGConstants.EVENT_FOCUS_OUT))
- {
- iCurrentIndex = INDEX_FOCUS_OUT;
- }
- else
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "setIndex() type:" + aType + " FALSE - end");
- // Wrong event type
- iCurrentIndex = INDEX_UNDEFINED;
- return false;
- }
- return true;
- }
-
- /**
- * Unregister an event target and an event listener pair
- * @param aTarget Target
- * @param aType Type
- * @param aListener Listener
- */
- public void unregister(EventTarget aTarget,
- String aType,
- EventListener aListener)
- {
- synchronized (this)
- {
- if (!prepare(aType))
- {
- return;
- }
- // Remove delayed registration
- iDelayedRegistrations.remove(aListener);
- // Remove real registration
- Vector listeners = (Vector)iEventTypes[iCurrentIndex].get(aTarget);
- boolean removed = false;
- if (listeners != null)
- {
- removed = listeners.removeElement(aListener);
- if (listeners.isEmpty())
- {
- iEventTypes[iCurrentIndex].remove(aTarget);
- }
- }
- if (removed)
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "unregister() ok - end");
- }
- else
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "unregister() failed - end");
- }
- }
- }
-
- /**
- * Helper class for handling delayed registration
- */
- class M2GEventData
- {
- public EventTarget iTarget = null;
- public String iType = null;
- public EventListener iListener = null;
-
- /**
- * Ctor
- */
- public M2GEventData()
- {
- }
-
- /**
- * Ctor
- * @param aTarget Target
- * @param aType Event type
- * @param aListener Event listener
- */
- public M2GEventData(
- EventTarget aTarget,
- String aType,
- EventListener aListener)
- {
- set(aTarget, aType, aListener);
- }
-
- /**
- * Clearing
- */
- public void clear()
- {
- iTarget = null;
- iType = null;
- iListener = null;
- }
-
- /**
- * Setter
- * @param aTarget Target
- * @param aType Event type
- * @param aListener Event listener
- */
- public void set(EventTarget aTarget,
- String aType,
- EventListener aListener)
- {
- iTarget = aTarget;
- iType = aType;
- iListener = aListener;
- }
- }
- }
-
- //--------------------------------------------------
- // STATIC METHODS
- //--------------------------------------------------
-
- /**
- * Creates an empty SVG document. The document contains a
- * root <svg> element with default viewport size of 100x100.
- * @param aImage -
- * @param aHander -
- * @return document object
- * @throws IllegalArgumentException
- * @throws IOException
- */
- static public M2GDocument buildEmptyDocument(M2GSVGImage aImage,
- ExternalResourceHandler aHandler)
- throws IllegalArgumentException, IOException
- {
- return M2GDocument.buildDocument(
- aImage,
- null,
- null,
- M2GSVGConstants.getInstance().iEmptySvgDocument,
- aHandler);
- }
-
- /**
- * Builds document
- * @param aImage Svg image
- * @param aBaseUrl A base url from where a document is downloaded.
- * @param aSuffixUrl The suffix url from where a document is downloaded.
- * @param aData Plain text svg data
- * @param aHandler Resource handler. If null the default resource handler is
- * used.
- * @return document object
- * @throws IllegalArgumentException
- * @throws IOException
- */
- static public M2GDocument buildDocument(M2GSVGImage aImage,
- String aBaseUrl,
- String aSuffixUrl,
- String aData,
- ExternalResourceHandler aHandler)
- throws IOException
- {
- System.out.println("P-M2GDocument");
- if ((aData == null) || (aData.equals("")))
- {
- System.out.println("P-M2GDocument (aData == null) || (aData.equals()");
- throw new IOException(
- /*SF*/"The SVG document does not conform to the XML 1.0 specification."/*SF*/);
- }
-
- M2GDocument document = new M2GDocument(aImage, aBaseUrl, aSuffixUrl, aData);
-
- if (document.doCheckValidity())
- {
- document.setResourceHandler(aHandler);
- return document;
- }
- throw new IOException(
- /*SF*/"The SVG document does not conform to the XML 1.0 specification."/*SF*/);
- }
-
- /**
- * Registers an observer to any DOM change
- * @since S60 3.2
- */
- public void registerDOMChangeObserver(M2GDOMChangeObserver aDOMChangeObserver)
- {
- iDOMChangeObserver = aDOMChangeObserver;
- }
-
- /**
- * Notify the observer about any change in DOM
- * SVGSVGElement is always part of DOM
- * @since S60 3.2
- */
- public void notifyDOMChangeObserver()
- {
- if (iDOMChangeObserver != null)
- {
- iDOMChangeObserver.notifyDOMChange();
- }
- }
-
- /**
- * Notify the observer about any change in DOM only if the node is in DOM
- * @param aNativeHandle the handle of a node
- * @since S60 3.2
- */
- public void notifyDOMChangeObserver(int aNativeHandle)
- {
- if (iDOMChangeObserver != null && isElementInDOM(aNativeHandle))
- {
- iDOMChangeObserver.notifyDOMChange();
- }
- }
-
-
- //--------------------------------------------------
- // NATIVE METHODS
- //--------------------------------------------------
- private native static int _createDocument(
- int aSvgProxyHandle, String aString);
-
- private native static int _createElementNS(
- int aSvgProxyHandle, short aType,
- int aDocumentHandle);
-
- private native static void _deleteDocument(
- int aSvgProxyHandle, int aDocumentHandle);
-
- private native static int _getElementById(
- int aSvgProxyHandle, int aDocumentHandle,
- String aId);
-
- private static native int _getViewportHeight(
- int aSvgProxyHandle, int aDocumentHandle);
-
- private static native int _getViewportWidth(
- int aSvgProxyHandle, int aDocumentHandle);
-
- private native static int _isElementInDOM(
- int aSvgProxyHandle, int aDocumentHandle,
- int aElementHandle);
-
- private static native int _requestCompleted(
- int aSvgProxyHandle, int aDocumentHandle,
- String aUri, byte[] aResourceData);
-
- private static native void _setViewportHeight(
- int aSvgProxyHandle, int aDocumentHandle, int aHeight);
-
- private static native void _setViewportWidth(
- int aSvgProxyHandle, int aDocumentHandle, int aWidth);
-}
-
--- a/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/M2GEvent.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-package com.nokia.microedition.m2g;
-
-import org.w3c.dom.events.*;
-import org.w3c.dom.svg.SVGElement;
-
-/**
- * The Event interface is used to provide contextual information about an event to the handler
- * processing the event. An object which implements the Event interface is passed as the first
- * parameter to the {@link org.w3c.dom.events.EventListener#handleEvent handleEvent} call.
- */
-public class M2GEvent implements Event
-{
- public static final boolean EVENT_TARGET = false;
- public static final boolean WRAPPED_EVENT_TARGET = true;
- //--------------------------------------------------
- // VARIABLES
- //--------------------------------------------------
- private String iEventType;
- private EventTarget iTarget;
- private boolean iWrappedTarget;
-
- //--------------------------------------------------
- // METHODS
- //--------------------------------------------------
- /**
- * Constructor
- * @param aEventType Type
- * @param aTarget Target
- * @param aWrappedTarget If WRAPPED_EVENT_TARGET then <code>getCurrentTarget</code>
- * method returns a wrapped event target (which base class is NOT <code>Node</code>.
- * Otherwise normal event target (which base class is <code>Node</code>) is returned.
- */
- public M2GEvent(String aEventType, EventTarget aTarget, boolean aWrappedTarget)
- {
- iEventType = aEventType;
- iTarget = aTarget;
- iWrappedTarget = aWrappedTarget;
- }
-
- /**
- * @see org.w3c.dom.events.Event#getCurrentTarget()
- * @see M2GEvent()
- */
- public EventTarget getCurrentTarget()
- {
- if (iWrappedTarget)
- {
- if ((iTarget != null) && (iTarget instanceof M2GSVGElement))
- {
- return new M2GSVGElementWrapper((M2GSVGElement)iTarget);
- }
- return null;
- }
- return iTarget;
- }
-
- /**
- * @see org.w3c.dom.events.Event#getType()
- */
- public String getType()
- {
- return iEventType;
- }
-}
--- a/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/M2GManager.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,271 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-package com.nokia.microedition.m2g;
-
-import java.lang.ref.WeakReference;
-//import com.nokia.mj.impl.rt.legacy.MIDEventServer;
-import java.util.Hashtable;
-//import com.nokia.mj.impl.rt.legacy.MemoryUtil;
-import java.util.Enumeration;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.*;
-
-
-public final class M2GManager implements Listener
-{
- //--------------------------------------------------
- // STATIC VARIABLES
- //--------------------------------------------------
-
- private static WeakReference sWeakManagerProxy = null;
- static Object sQuard = new Object();
-
- //--------------------------------------------------
- // VARIABLES
- //--------------------------------------------------
- private Hashtable iLiveObjects = new Hashtable();
- private M2GWeakManager iWeakManager = null;
- private int iSVGProxyHandle = M2GObject.INVALID_NATIVE_HANDLE;
-
- //--------------------------------------------------
- // METHODS
- //--------------------------------------------------
-
- /**
- * Constructor
- */
- private M2GManager()
- {
- super();
- System.out.println("P- Manager Constructor.." );
-
- //As Display is created in Thread only.. So no need to handle display over here.
- //scom.nokia.mj.impl.rt.support.Jvm.loadSystemLibrary("javam2g");
- /*// setup the finalization via eswt's Display
- Display display = Display.getCurrent();
- if (display == null)
- {
- return; // ?
- }
- display.addListener(SWT.Dispose, (Listener)this); */
-
- System.out.println("P- Manager Constructor.._createSvgProxy calleds" );
- // Execute in UI thread
- Platform.executeInUIThread(
- new M2GRunnableQt() {
- public void doRun() {
- iSVGProxyHandle = _createSvgProxy();
- }
- });
- M2GManager.heuristicGC();
- }
-
- /**
- * Impelements 'handleEvent' from Listener
- */
- public void handleEvent(Event e)
- {
- if (e.type == SWT.Dispose)
- {
- doCleanup();
- }
- }
-
- /**
- * Does the cleanuping
- */
- protected void doCleanup()
- {
- finalizeObjects();
- synchronized (sQuard)
- {
- _deleteSvgProxy(iSVGProxyHandle);
- iSVGProxyHandle = M2GObject.INVALID_NATIVE_HANDLE;
- sWeakManagerProxy = null;
- iLiveObjects = null;
- }
- }
-
-
- /**
- * Find an element from the handle-to-element map.
- * @param aElementHandle Handle
- * @return SVGElement. Null if not found
- */
- synchronized private void finalizeObjects()
- {
- Enumeration objects = iLiveObjects.elements();
- while (objects.hasMoreElements())
- {
- Object weakObject = ((WeakReference)objects.nextElement()).get();
- if (weakObject != null)
- {
- ((M2GObject)weakObject).registeredFinalize();
- }
- }
- // Clear table
- iLiveObjects.clear();
- }
-
-
- /**
- * Gets native SVG proxy handle
- * @return SVG proxy handle
- */
- public int getSVGProxyHandle()
- {
- synchronized (sQuard)
- {
- return iSVGProxyHandle;
- }
- }
-
- /**
- * Gets native SVG proxy handle
- * @return SVG proxy handle
- */
- void init(M2GWeakManager aWeakManager)
- {
- iWeakManager = aWeakManager;
- }
-
- /**
- * Register an object
- * @param aObject Object
- */
- synchronized public void register(M2GObject aObject)
- {
- if (aObject == null)
- {
- return;
- }
- iLiveObjects.put(new Integer(aObject.getHandle()), new WeakReference(aObject));
- }
-
- /**
- * Unregister an object
- * @param aHandle Object's native handle
- */
- synchronized public void unregister(Integer aHandle)
- {
- iLiveObjects.remove(aHandle);
- }
-
- //--------------------------------------------------
- // STATIC METHODS
- //--------------------------------------------------
-
- /**
- * Gets instance of singleton manager object
- * @return manager object reference
- */
- static public M2GManager getInstance()
- {
- M2GWeakManager weakManager = null;
- synchronized (sQuard)
- {
- if (sWeakManagerProxy != null)
- {
- System.out.println("P- getInstance M2GManager Construction sWeakManagerProxy != null.." );
- weakManager = (M2GWeakManager)sWeakManagerProxy.get();
- }
- // Check if object null
- if (weakManager == null)
- {
- // Create a new object and put it into the static member variable
- System.out.println("P- getInstance M2GManager Construction sWeakManagerProxy == null.." );
- weakManager = new M2GWeakManager(new M2GManager());
- sWeakManagerProxy = new WeakReference(weakManager);
- }
- return weakManager.getInstance();
- }
- }
-
- /**
- * Trigger GC every N objects
- */
- static final void heuristicGC()
- {
- //MemoryUtil.ensureMinFreeRAM();
- }
-
- //--------------------------------------------------
- // NATIVE METHODS
- //--------------------------------------------------
- private static native int _createSvgEngine(int aSvgProxyHandle );
-
- private static native int _createSvgProxy();
-
- private static native void _deleteSvgEngine(int aSvgProxyHandle, int aSvgEngineHandle);
-
- private static native void _deleteSvgProxy( int aSvgProxyHandle);
-
-
-}
-
-//--------------------------------------------------
-// OTHER CLASSES
-//--------------------------------------------------
-
-/*
- * M2GWeakManager takes care of carbage colletion of an M2GManager object
- */
-class M2GWeakManager
-{
- //--------------------------------------------------
- // VARIABLES
- //--------------------------------------------------
- M2GManager iManager;
-
- //--------------------------------------------------
- // METHODS
- //--------------------------------------------------
-
- /**
- * Constructor
- * @param aManager Manager object
- */
- public M2GWeakManager(M2GManager aManager)
- {
- reset(aManager);
- }
-
- /**
- * Return a reference to the manager
- * @return a reference to the manager
- */
- M2GManager getInstance()
- {
- return iManager;
- }
-
- /**
- * Reset
- * @param aManager
- */
- void reset(M2GManager aManager)
- {
- iManager = aManager;
- if (iManager != null)
- {
- iManager.init(this);
- }
- }
-}
--- a/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/M2GObject.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,228 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-package com.nokia.microedition.m2g;
-
-import java.io.IOException;
-
-import com.nokia.microedition.m2g.NativeError;
-import com.nokia.mj.impl.rt.support.Finalizer;
-import com.nokia.mj.impl.utils.Logger;
-
-
-/**
- * Base class
- */
-abstract class M2GObject
-{
- //--------------------------------------------------
- // STATIC CONSTANTS
- //--------------------------------------------------
- public static final int INVALID_NATIVE_HANDLE = 0;
- // static final String ESWT_PACKAGE = "org.eclipse.swt.widgets.Display" ;
- //--------------------------------------------------
- // VARIABLES
- //--------------------------------------------------
- int iNativeHandle;
- M2GManager iManager;
- private Finalizer mFinalizer;
-
- //--------------------------------------------------
- // METHODS
- //--------------------------------------------------
- /**
- * Constructor.
- */
- M2GObject()
- {
- this(INVALID_NATIVE_HANDLE);
- System.out.println("P- M2GObject(s)" );
- }
-
- /**
- * Constructor.
- * @param a native handle
- */
- M2GObject(int aHandle)
- {
- System.out.println("P- M2GObject(int aHandle)" );
- iNativeHandle = aHandle;
- System.out.println("P- M2GManager Construction.." );
- iManager = M2GManager.getInstance();
- System.out.println("P- M2GManager Construction complete.." );
- }
-
- /**
- * Checks handle validity.
- * @return true if valid
- */
- boolean doCheckValidity() throws IOException
- {
- return isHandleValid();
- }
-
- /**
- * Cleanup operations.
- */
- abstract void doCleanup();
-
- /**
- * Construct operations. Registration for finalization is done here.
- */
- void doConstruct()
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "doConstruct(), register for finalization: "
- + this.getClass().getName());
- M2GManager.heuristicGC();
- mFinalizer = new Finalizer()
- {
- public void finalizeImpl()
- {
- doFinalize();
- }
- };
- }
-
- /**
- * Create destroyer.
- */
- void createDestroyer()
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "createDestroyer(): " + this.getClass().getName());
-
- }
-
- /**
- * Gets native handle
- * @return native handle
- */
- int getHandle()
- {
- return iNativeHandle;
- }
-
- /**
- * Gets native proxy handle
- * @return native handle
- */
- int getNativeSVGProxyHandle()
- {
- return iManager.getSVGProxyHandle();
- }
-
- /**
- * Checks if native handle is valid.
- */
- boolean isHandleValid()
- {
- M2GObject.checkNativeError(iNativeHandle);
- return M2GObject.checkHandle(iNativeHandle);
- }
-
- /**
- * Register an object
- * @param aObject Object
- */
- void register(M2GObject aObject)
- {
- iManager.register(aObject);
- }
-
- /**
- * @see ObjectExtensions#registerForFinalization()
- */
- private void doFinalize()
- {
- if (mFinalizer != null)
- {
- registeredFinalize();
- mFinalizer = null;
- }
- }
-
- synchronized final void registeredFinalize()
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "registeredFinalize() begin - doCleanup() is called");
- doCleanup();
- Logger.LOG(Logger.EJavaUI, Logger.EInfo, "registeredFinalize() end");
- }
-
- /**
- * This method is called in Toolkit's destroyNotify call.
- * This will release convenient native resources. All native resource
- * will be deleted in registeredFinalize() method.
- */
- synchronized final void release()
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo, "release()");
- }
-
- /**
- * Initializes native handles.
- */
- void resetHandles()
- {
- iNativeHandle = INVALID_NATIVE_HANDLE;
- }
-
- /**
- * Sets a native handle.
- */
- void setHandle(int aNativeHandle)
- {
- iNativeHandle = aNativeHandle;
- }
-
- /**
- * Unregister an object
- * @param aHandle Object's native handle
- */
- void unregister(Integer aHandle)
- {
- iManager.unregister(aHandle);
- }
-
- //--------------------------------------------------
- // STATIC METHODS
- //--------------------------------------------------
- /**
- * Checks that the handle is valid.
- * @param a native handle
- * @return true if handle is valid.
- */
- static boolean checkHandle(int aHandle)
- {
- return (aHandle > INVALID_NATIVE_HANDLE ? true : false);
- }
-
- /**
- * Checks for basic native error codes that maps to
- * standard Java exceptions and throws the exception if the error
- * code matches. Otherwise throws basic Error class.
- * @param aErrorCode Error code
- * @return Value passed in is returned if not an error
- * @throws Error if error
- */
- static int checkNativeError(int aErrorCode)
- {
- return NativeError.check(aErrorCode);
- }
-}
-
--- a/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/M2GRunnableQt.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-/*
-* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-package com.nokia.microedition.m2g;
-
-/**
- * Class that wraps runnable in order to catch and forward
- * exceptions that occured when executing in UI thread.
- * This class is used only for running native methods in UI thread.
- */
-abstract class M2GRunnableQt implements Runnable
-{
- private Throwable e = null;
-
- /**
- * From Runnable interface
- */
- public void run()
- {
- try
- {
- doRun();
- }
- catch (Throwable t)
- {
- e = t;
- }
- }
-
- /**
- * Checks for possible exceptions and errors and throws them forward.
- * Only unchecked exceptions and errors are thrown as only checked
- * exception that m3gcore may throw comes from loader which is not
- * executed in UI thread
- *
- * @throws RuntimeException
- * @throws Error
- */
- public void checkAndThrow()
- {
- if (e == null)
- {
- return;
- }
- if (e instanceof RuntimeException)
- {
- throw(RuntimeException)e;
- }
- else if (e instanceof Error)
- {
- throw(Error)e;
- }
- }
-
- /**
- * Method to be implemented for the UI thead execution
- */
- abstract void doRun();
-}
\ No newline at end of file
--- a/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/M2GSVGAnimationElement.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-package com.nokia.microedition.m2g;
-
-import org.w3c.dom.svg.*;
-import com.nokia.mj.impl.utils.Logger;
-
-
-/**
- * This interface represents an Animation element,
- * which contains methods to control the timing of
- * animations.
- */
-public class M2GSVGAnimationElement
- extends M2GSVGElement
- implements SVGAnimationElement
-{
- //--------------------------------------------------
- // METHODS
- //--------------------------------------------------
- /**
- * Constructor
- * @param aElemnetHandle -
- * @param aDocument -
- */
- public M2GSVGAnimationElement(int aElementHandle, M2GDocument aDocument)
- {
- super(aElementHandle, aDocument);
- }
-
- /**
- * @see org.w3c.dom.svg.SVGAnimationElement#beginElementAt()
- */
- public void beginElementAt(float offset)
- {
- _beginElementAt(
- getNativeSVGProxyHandle(),
- getDocument().getHandle(), getHandle(), offset,
- getDocument().getRootElement().getCurrentTime() );
- }
-
- /**
- * Same as the beginElementAt with offset 0.0f
- * @see org.w3c.dom.svg.SVGAnimationElement#beginElementAt()
- */
- public void beginElement()
- {
- beginElementAt(0.0f);
- }
-
- /**
- * @see org.w3c.dom.svg.SVGAnimationElement#endElementAt()
- */
- public void endElementAt(float offset)
- {
- short endAttribute = _getEnumTrait(
- getNativeSVGProxyHandle(),
- getHandle(), M2GSVGConstants.AT_END );
- // NOTE Native SVG engine checks that element is active so
- // java side doesn't have to do that
- if (endAttribute == M2GSVGConstants.ANIM_INDEFINITE)
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "endElementAt() - Cannot stop this animation, indefinite attribute");
- }
- else
- {
- _endElementAt(
- getNativeSVGProxyHandle(),
- getDocument().getHandle(), getHandle(),
- (offset + getDocument().getRootElement().getCurrentTime()) );
- }
- }
-
-
- //--------------------------------------------------
- // NATIVE METHODS
- //--------------------------------------------------
- private native void _beginElementAt(
- int aSvgProxyHandle, int aDocumentHandle,
- int aElementHandle, float aOffset, float aCurrentTime);
-
- private native void _endElementAt(
- int aSvgProxyHandle, int aDocumentHandle,
- int aElementHandle, float aOffset);
-
- private native boolean _isActive(
- int aSvgProxyHandle, int aElementHandle);
-}
--- a/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/M2GSVGAnimator.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,765 +0,0 @@
-/*
-* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-package com.nokia.microedition.m2g;
-
-import javax.microedition.m2g.*;
-import java.util.*;
-import javax.microedition.lcdui.*;
-import javax.microedition.lcdui.game.GameCanvas;
-import java.lang.ref.WeakReference;
-import com.nokia.mj.impl.rt.support.Finalizer;
-import com.nokia.mj.impl.utils.Logger;
-
-
-public class M2GSVGAnimator extends SVGAnimator
-{
- //--------------------------------------------------
- // STATIC CONSTANTS
- //--------------------------------------------------
- private static final String ANIMATOR_CANVAS_BASE_CLASS =
- "javax.microedition.lcdui.Canvas";
- // Exception text
- /* Optimization: static finals changed to local variables
- private static final String COMPONENT_BASE_CLASS_NOT_SUPPORTED_ESTR =
- "The requested componentBaseClass is not supported by the implementation.";
- private static final String ILLEGAL_TIME_INCREMENT_ESTR =
- "The timeIncrement is less than or equal to zero.";
- private static final String ANIMATOR_PLAY_ESTR =
- "The animator is not currently in the stopped or paused state.";
- private static final String ANIMATOR_PAUSE_ESTR =
- "The animator is not in the playing state.";
- private static final String ANIMATOR_STOP_ESTR =
- "The animator is not in the playing or paused state.";
- private static final String INVALID_RUNNABLE_ESTR =
- "The runnable is null.";
- private static final String ANIMATOR_IS_STOPPED_ESTR =
- "The animator is in the stopped state.";
- private static final String RUNNABLE_IS_NULL_ESTR =
- "The runnable is null.";
- private static final String ANIMATOR_INVOKE_ESTR =
- "The animator is in the stopped state.";
- */
-
- //--------------------------------------------------
- // VARIABLES
- //--------------------------------------------------
- private M2GSVGCanvas iSVGCanvas = null;
- private Finalizer mFinalizer;
-
- //--------------------------------------------------
- // METHODS
- //--------------------------------------------------
- /**
- * Constructor
- * @param aImage
- */
- protected M2GSVGAnimator(SVGImage aImage)
- {
- System.out.println("P-Do In M2GSVGAnimator(SVGImage aImage).");
- iSVGCanvas = new M2GSVGCanvas(false, aImage);
- mFinalizer = new Finalizer()
- {
- public void finalizeImpl()
- {
- System.out.println("P-Do In M2GSVGAnimator(SVGImage aImage).mFinalizer creation doFinalize" );
- doFinalize();
- }
- };
- System.out.println("P-Do In M2GSVGAnimator(SVGImage aImage).mFinalizer M2GDestroyer creation " );
- }
-
- /**
- * @see javax.microedition.m2g.SVGAnimator#getTargetComponent()
- */
- public Object getTargetComponent()
- {
- return iSVGCanvas;
- }
-
- /**
- * @see javax.microedition.m2g.SVGAnimator#getTimeIncrement()
- */
- public float getTimeIncrement()
- {
- return iSVGCanvas.getTimeIncrement();
- }
-
- /**
- * @see javax.microedition.m2g.SVGAnimator#invokeAndWait()
- */
- public void invokeAndWait(java.lang.Runnable runnable)
- {
- if (runnable == null)
- {
- throw new NullPointerException(
- /*SF*/"The runnable is null."/*SF*/);
- }
- if (iSVGCanvas.isStopped())
- {
- throw new IllegalStateException(
- /*SF*/"The animator is in the stopped state."/*SF*/);
- }
- Logger.LOG(Logger.EJavaUI, Logger.EInfo, "invokeAndWait()");
- runnable.run();
- }
-
- /**
- * @see javax.microedition.m2g.SVGAnimator#invokeLater()
- */
- public void invokeLater(java.lang.Runnable runnable)
- {
- if (runnable == null)
- {
- throw new NullPointerException(
- /*SF*/"The runnable is null."/*SF*/);
- }
- if (iSVGCanvas.isStopped())
- {
- throw new IllegalStateException(
- /*SF*/"The animator is in the stopped state."/*SF*/);
- }
- Logger.LOG(Logger.EJavaUI, Logger.EInfo, "invokeLater()");
- Thread thread = new Thread(runnable);
- thread.start();
- }
-
- /**
- * @see javax.microedition.m2g.SVGAnimator#pause()
- */
- public void pause()
- {
- if (!iSVGCanvas.isPlaying())
- {
- throw new IllegalStateException(
- /*SF*/"The animator is not in the playing or paused state."/*SF*/);
- }
- Logger.LOG(Logger.EJavaUI, Logger.EInfo, "pause()");
- iSVGCanvas.pause();
- }
-
- /**
- * @see javax.microedition.m2g.SVGAnimator#play()
- */
- public void play()
- {
- System.out.println("P-Do In M2GSVGAnimator Play " );
- if (iSVGCanvas.isPlaying())
- {
- throw new IllegalStateException(
- /*SF*/"The animator is not currently in the stopped or paused state."/*SF*/);
- }
- Logger.LOG(Logger.EJavaUI, Logger.EInfo, "play()");
- System.out.println("P-Do In M2GSVGAnimator canvas sPlay " );
- iSVGCanvas.play();
- }
-
- private void doFinalize()
- {
- if (mFinalizer != null)
- {
- System.out.println("P-Do Finalize called");
- registeredFinalize();
- mFinalizer = null;
- }
- }
-
- /**
- * Finalize
- */
- synchronized void registeredFinalize()
- {
- iSVGCanvas.cancel();
- iSVGCanvas = null;
- }
-
-
- /**
- * @see javax.microedition.m2g.SVGAnimator#setSVGEventListener()
- */
- public void setSVGEventListener(SVGEventListener svgEventListener)
- {
- iSVGCanvas.setEventListener(svgEventListener);
- }
-
- /**
- * @see javax.microedition.m2g.SVGAnimator#setTimeIncrement()
- */
- public void setTimeIncrement(float timeIncrement)
- {
- System.out.println("P-Do In M2GSVGAnimator TimeIncrement.." );
- if (timeIncrement <= 0)
- {
- throw new IllegalArgumentException(
- /*SF*/"The time increment is less than or equal to zero."/*SF*/);
- }
- Logger.LOG(Logger.EJavaUI, Logger.EInfo, "setTimeIncrement() - "
- + timeIncrement);
- iSVGCanvas.setTimeIncrement(timeIncrement);
- System.out.println("P-Do In M2GSVGAnimator Canvas Time Increment.." );
- }
-
- /**
- * @see javax.microedition.m2g.SVGAnimator#stop()
- */
- public void stop()
- {
- System.out.println("P-Do In M2GSVGAnimator Stoop " );
- if (iSVGCanvas.isStopped())
- {
- throw new IllegalStateException(
- /*SF*/"The animator is not in the playing or paused state."/*SF*/);
- }
- Logger.LOG(Logger.EJavaUI, Logger.EInfo, "stop()");
-
- iSVGCanvas.stop();
- System.out.println("P-Do In M2GSVGAnimator Canvas Stop" );
- }
-
- //--------------------------------------------------
- // STATIC METHODS
- //--------------------------------------------------
- /**
- * Builds animator
- * @param svgImage -
- * @return SVGAnimator
- * @see javax.microedition.m2g.SVGAnimator#createAnimator()
- */
- public static SVGAnimator buildAnimator(SVGImage svgImage)
- {
- System.out.println("P-Do SVGAnimator buildAnimator.");
- if (svgImage == null)
- {
- System.out.println("P-Do SVGAnimator buildAnimator.NullPointerException.");
- throw new NullPointerException();
- }
- System.out.println("P-Do SVGAnimator buildAnimator.retunrning handle");
- return new M2GSVGAnimator(svgImage);
- }
-
- /**
- * Builds animator
- * @param svgImage -
- * @param componentBaseClass -
- * @return SVGAnimator
- * @see javax.microedition.m2g.SVGAnimator#createAnimator()
- */
- public static SVGAnimator buildAnimator(
- SVGImage svgImage, String componentBaseClass)
- {
- if (svgImage == null)
- {
- throw new NullPointerException();
- }
- if ((componentBaseClass != null) &&
- (!componentBaseClass.equals(ANIMATOR_CANVAS_BASE_CLASS)))
- {
- throw new IllegalArgumentException(
- /*SF*/"The requested componentBaseClass is not supported by the implementation."/*SF*/);
- }
- return buildAnimator(svgImage);
- }
-}
-
-//--------------------------------------------------
-// OTHER CLASSES
-//--------------------------------------------------
-
-/**
- * Canvas
- */
-class M2GSVGCanvas extends GameCanvas implements M2GDOMChangeObserver
-{
- //--------------------------------------------------
- // STATIC CONSTANTS
- //--------------------------------------------------
- public static final int STATE_STOPPED = 1;
- public static final int STATE_PLAYING = 2;
- public static final int STATE_PAUSED = 3;
- public static final float DEFAULT_DELTA_TIME = 0.1f; // (10fps) - defined by specs
-
- //--------------------------------------------------
- // VARIABLES
- //--------------------------------------------------
- private int iState;
- private SVGImage iSVGImage;
- private ScalableGraphics iSg;
- private Graphics iOffscreen = null;
- private M2GSVGSVGElement iRootElement = null;
-
- private float iDeltaTime;
- private Timer iTimer = null;
- private SVGCanvasTask iTask = null;
-
- private SVGEventListener iEventListener = null;
-
- /**
- * True if the GameCanvas is in background or false otherwise
- */
- private boolean iWasPlaying = false;
-
- //--------------------------------------------------
- // METHODS
- //--------------------------------------------------
- /**
- * @see javax.microedition.lcdui.game.GameCanvas#GameCanvas()
- */
- public M2GSVGCanvas(boolean aSuppressKeyEvents, SVGImage aSVGImage)
- {
-
- super(aSuppressKeyEvents);
- System.out.println("P-Do M2GSVGCanvas Canvas called");
- // get the instance to the Graphics of the offscreen buffer
- iOffscreen = getGraphics();
-
- iSVGImage = aSVGImage;
-
- // down-casting to M2GDocument/M2GSVGSVGElement to have access to internal methods
- M2GDocument doc = (M2GDocument)iSVGImage.getDocument();
- iRootElement = (M2GSVGSVGElement)iSVGImage.getDocument().getDocumentElement();
-
- System.out.println("P-Do M2GSVGCanvas Doc and RootElement Created");
- iState = STATE_STOPPED;
- // Create render context
- iSg = ScalableGraphics.createInstance();
- iSg.setRenderingQuality(ScalableGraphics.RENDERING_QUALITY_HIGH);
- iDeltaTime = DEFAULT_DELTA_TIME;
-
- doc.registerDOMChangeObserver(this);
-
- System.out.println("P-Do M2GSVGCanvas Canvas Registered Dom Observer");
-
- Logger.LOG(Logger.EJavaUI, Logger.EInfo, "Ctor - delta time:"
- + iDeltaTime + ", state:" + iState);
- }
-
- /**
- * Handles any change in DOM.
- * <br>
- * While in PAUSE state, SVGAnimator must repaint any changes in SVGImage
- * done via the API (e.g. setTrait(), insertBefore())
- * <br>
- * @see M2GDOMChangeObserver.notifyDOMChange()
- * @since S60 3.2
- */
- public void notifyDOMChange()
- {
- if (isPaused())
- {
- repaint();
- }
- }
-
- /**
- * Cancel a timed task
- */
- public void cancel()
- {
- if (iTimer != null)
- {
- iTimer.cancel();
- }
- if (iTask != null)
- {
- iTask.cancel();
- }
- iTask = null;
- iTimer = null;
- }
-
- /**
- * Returns event listener
- * @return event listener
- */
- public synchronized SVGEventListener getEventListener()
- {
- return iEventListener;
- }
-
- /**
- * @see javax.microedition.m2g.SVGAnimator#getTimeIncrement()
- */
- public synchronized float getTimeIncrement()
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo, "getTimeIncrement() - "
- + iDeltaTime);
- return iDeltaTime;
- }
-
- /**
- * Increases the increment time of the SVGImage.
- * Increment is done only if the playing state is active.
- * @see javax.microedition.m2g.SVGImage#incrementTime()
- */
- public synchronized void increaseCurrentTime(float time)
- {
- if (iState == STATE_PLAYING)
- {
- // update the time only in java side
- // the time in engine side is updated during rendering
- iRootElement.incrementTimeNoUpdate(time);
- }
- }
-
- /**
- * Checks if playing
- * @return true if playing
- */
- public synchronized boolean isPlaying()
- {
- return iState == STATE_PLAYING;
- }
-
- /**
- * Checks if paused
- * @return true if paused
- */
- public synchronized boolean isPaused()
- {
- return iState == STATE_PAUSED;
- }
-
- /**
- * Checks if stopped
- * @return true if stopped
- */
- public synchronized boolean isStopped()
- {
- return iState == STATE_STOPPED;
- }
-
- /**
- * @see javax.microedition.lcdui.Canvas#keyPressed()
- */
- protected synchronized void keyPressed(int keyCode)
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo, "keyPressed() - " + keyCode);
- if (iEventListener != null)
- {
- iEventListener.keyPressed(keyCode);
- }
- }
-
- /**
- * @see javax.microedition.lcdui.Canvas#keyReleased()
- */
- protected synchronized void keyReleased(int keyCode)
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo, "keyReleased() - " + keyCode);
- if (iEventListener != null)
- {
- iEventListener.keyReleased(keyCode);
- }
- }
-
- /**
- * @see javax.microedition.lcdui.Canvas#pointerPressed()
- * @see javax.microedition.m2g.SVGEventListener#pointerPressed()
- */
- protected synchronized void pointerPressed(int x, int y)
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "pointerPressed() - x:" + x + ", y:" + y);
- if (iEventListener != null)
- {
- iEventListener.pointerPressed(x, y);
- }
- }
-
- /**
- * @see javax.microedition.lcdui.Canvas#pointerReleased()
- * @see javax.microedition.m2g.SVGEventListener#pointerReleased()
- */
- protected synchronized void pointerReleased(int x, int y)
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "pointerReleased() - x:" + x + ", y:" + y);
- if (iEventListener != null)
- {
- iEventListener.pointerReleased(x, y);
- }
- }
-
- /**
- * @see javax.microedition.lcdui.game.GameCanvas#paint()
- */
- public void paint(Graphics g)
- {
- // Clears bitmap
- System.out.println("P-Do M2GSVGAnimator Paint");
- g.setColor(255, 255, 255);
- g.fillRect(0, 0, getWidth(), getHeight());
-
- try
- {
- System.out.println("P-Do M2GSVGAnimatorBind Target");
- iSg.bindTarget(g);
-
- System.out.println("P-Do M2GSVGAnimatorBind Target");
- // NOTE: Source is defaultly fully opaque
- iSg.render(0, 0, iSVGImage);
- System.out.println("P-Do M2GSVGAnimatorBind Target");
- }
- finally
- {
- System.out.println("P-Do M2GSVGAnimator Release Target");
- iSg.releaseTarget();
- System.out.println("P-Out M2GSVGAnimator Release Target");
- }
- }
-
- /**
- * Paints a frame to the offscreen of this GameCanvas
- * @note GameCanvas.getGraphics() is not used since it always creates a new instance of Graphics
- */
- public void paintToOffscreen()
- {
- paint(iOffscreen);
- }
-
- /**
- * @see javax.microedition.m2g.SVGAnimator#setSVGEventListener()
- */
- public synchronized void setEventListener(SVGEventListener eventListener)
- {
- iEventListener = eventListener;
- }
-
- /**
- * @see javax.microedition.m2g.SVGAnimator#setTimeIncrement()
- */
- public synchronized void setTimeIncrement(float aDeltaTime)
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo, "setTimeIncrement() - "
- + aDeltaTime);
-
- iDeltaTime = aDeltaTime;
- }
-
-
- /**
- * @see javax.microedition.lcdui.Canvas#showNotify()
- * @see javax.microedition.m2g.SVGEventListener#showNotify()
- */
- protected synchronized void showNotify()
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo, "showNotify()");
-
- if (iEventListener != null)
- {
- iEventListener.showNotify();
- }
-
- // A common use-case could be that the developer plays the animation by themselves
- // in SVGEventListener.showNotify().
- // Therefore we play the animation only if the developer didn't resume it already.
- if (iWasPlaying)
- {
- iWasPlaying = false;
- play();
- }
- }
-
- /**
- * @see javax.microedition.lcdui.Canvas#hideNotify()
- * @see javax.microedition.m2g.SVGEventListener#hideNotify()
- */
- protected synchronized void hideNotify()
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo, "hideNotify()");
-
- if (iEventListener != null)
- {
- iEventListener.hideNotify();
- }
-
- // A common use-case could be that developer pause the animation by themselves
- // in SVGEventListener.hideNotify().
- // Therefore we pause the animation only if the developer didn't pause it already.
- if (isPlaying())
- {
- pause();
- iWasPlaying = true;
- }
- }
-
-
- /**
- * @see javax.microedition.lcdui.Canvas#sizeChanged()
- * @see javax.microedition.m2g.SVGEventListener#sizeChanged()
- */
- protected synchronized void sizeChanged(int w, int h)
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo, "sizeChanged() - w:"
- + w + ", h:" + h);
-
- // get a new instance of offscreen Graphics since the Graphics object
- // does not update its size or clipping area.
- // If not updating this, the GameCanvas is clipped when it is switched
- // to full-screen
- if (iOffscreen != null)
- {
- // sizeChanged() is called twice when the Canvas is set as Displayable.
- // If we try to get the Graphics object (first time), the Graphics object is not
- // fully initialized, so GameCanvas.getGraphics() will throw a NullPointerException
- iOffscreen = getGraphics();
- }
-
- if (iSVGImage != null)
- {
- iSVGImage.setViewportWidth(w);
- iSVGImage.setViewportHeight(h);
- }
-
- if (iEventListener != null)
- {
- iEventListener.sizeChanged(w, h);
- }
- }
-
- /**
- * @see javax.microedition.m2g.SVGAnimator#play()
- */
- public synchronized void play()
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo, "play()");
- System.out.println("P-Do M2GSVGAnimator Play )= Target");
- if (iState == STATE_PLAYING)
- {
- // don't do anything if animation is already playing
- return;
- }
-
- if ((iState == STATE_PAUSED)||(iState == STATE_STOPPED))
- {
- iTask = new SVGCanvasTask(this);
- iTimer = new Timer();
- }
- iState = STATE_PLAYING;
- if (iTimer != null && iTask != null)
- {
-
- iTimer.schedule(iTask,0,(long)(iDeltaTime*1000.0f));
-
- }
- }
-
- /**
- * @see javax.microedition.m2g.SVGAnimator#pause()
- */
- public synchronized void pause()
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo, "pause()");
-
- if (iState == STATE_PLAYING)
- {
- iTask.cancel();
- iTask = null;
- iTimer.cancel();
- iTimer = null;
- }
- iState = STATE_PAUSED;
-
- }
-
- /**
- * @see javax.microedition.m2g.SVGAnimator#stop()
- */
- public synchronized void stop()
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo, "stop()");
- if (iState == STATE_PLAYING)
- {
- iTask.cancel();
- iTask = null;
- iTimer.cancel();
- iTimer = null;
- }
- iState = STATE_STOPPED;
- }
-}
-
-/**
- * Timer task for rendering frames
- */
-class SVGCanvasTask extends TimerTask
-{
- //--------------------------------------------------
- // VARIABLES
- //--------------------------------------------------
- // private WeakReference iWeakCanvas;
-
- private M2GSVGCanvas iCanvas = null;
- private long iPrevTime = 0;
-
- //--------------------------------------------------
- // METHODS
- //--------------------------------------------------
- /**
- * Constructor
- * @param aCanvas SVG canvas
- */
- public SVGCanvasTask(M2GSVGCanvas aCanvas)
- {
- // iWeakCanvas = new WeakReference(aCanvas);
- // iCanvas = (M2GSVGCanvas)iWeakCanvas.get();
-
- iCanvas = aCanvas;
- iPrevTime = System.currentTimeMillis();
- }
- /**
- * Updates the animation time and generates frames which get flushed to the screen
- * <br>
- * * @note The timing for the next frame is decided upon the max(iDeltaTime*1000, elapsedTime)
- * iDeltaTime: FrameTime set by client.
- * elapsedTime: Actual Time taken for rendering
- the max(iDeltaTime*1000, elapsedTime) will be incremented on the SVGElement
- * @note rendering will be done only in PLAY state.
- * @note While in PAUSE state, SVGAnimator will repaint any changes done
- * to SVGImage via <code>M2GDOMChangeObserver.notifyDOMChange()</code>
- */
- public void run()
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "SVGCanvasTask: run() - begin");
-
- if (iCanvas == null)
- {
- return;
- }
-
- try
- {
- synchronized (iCanvas)
- {
- long elapsedTime = System.currentTimeMillis()- iPrevTime;
- if (elapsedTime > 0)
- iCanvas.increaseCurrentTime((float)(elapsedTime/ 1000.));
- iPrevTime = System.currentTimeMillis();
- iCanvas.paintToOffscreen();
- iCanvas.flushGraphics();
- }
- }
- catch (Exception e)
- {
- Logger.ELOG(Logger.EJavaUI,
- "SVGCanvasTask: run() - exception: " + e.toString());
- }
- Logger.LOG(Logger.EJavaUI, Logger.EInfo, "SVGCanvasTask: run() - end");
-
- }
-}
--- a/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/M2GSVGConstants.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1893 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-package com.nokia.microedition.m2g;
-
-import java.util.Hashtable;
-import java.util.Enumeration;
-import java.util.Vector;
-import org.w3c.dom.svg.SVGPath;
-
-/*
- * General constants
- */
-public class M2GSVGConstants
-{
-
- //--------------------------------------------------
- // STATIC CONSTANTS - General exception messages
- //--------------------------------------------------
- public static final String ACCESS_RIGHTS_ESTR =
- "Not necessary privilege rights to access this (SVG) content.";
-
- //--------------------------------------------------
- // STATIC CONSTANTS
- //--------------------------------------------------
- static final String SVG_NAMESPACE_URI =
- "http://www.w3.org/2000/svg";
- static final String XLINK_NAMESPACE_URI =
- "http://www.w3.org/1999/xlink";
- static final String ROOT_SVG_ELEMENT_NAME =
- "svg";
-
- //--------------------------------------------------
- // STATIC CONSTANTS - Supported event types
- //--------------------------------------------------
- static final String EVENT_ACTIVATE = "DOMActivate";
- static final String EVENT_CLICK = "click";
- static final String EVENT_FOCUS_IN = "DOMFocusIn";
- static final String EVENT_FOCUS_OUT = "DOMFocusOut";
-
- //--------------------------------------------------
- // STATIC CONSTANTS - SVGT element ids
- //--------------------------------------------------
- static final short EL_UNDEFINED = -1;
- static final short EL_A = 0;
- static final short EL_ANIMATE = 1;
- static final short EL_ANIMATECOLOR = 2;
- static final short EL_ANIMATEMOTION = 3;
- static final short EL_ANIMATETRANSFORM = 4;
- static final short EL_CIRCLE = 5;
- static final short EL_DEFS = 6;
- static final short EL_DESC = 7;
- static final short EL_ELLIPSE = 8;
- static final short EL_FONT = 9;
- static final short EL_FONTFACE = 10;
- static final short EL_FONTFACENAME = 11;
- static final short EL_FONTFACESRC = 12;
- static final short EL_FOREIGNOBJECT = 13;
- static final short EL_G = 14;
- static final short EL_GLYPH = 15;
- static final short EL_HKERN = 16;
- static final short EL_IMAGE = 17;
- static final short EL_LINE = 18;
- static final short EL_METADATA = 19;
- static final short EL_MISSINGGLYPH = 20;
- static final short EL_MPATH = 21;
- static final short EL_PATH = 22;
- static final short EL_POLYGON = 23;
- static final short EL_POLYLINE = 24;
- static final short EL_RECT = 25;
- static final short EL_SET = 26;
- static final short EL_SVG = 27;
- static final short EL_SWITCH = 28;
- static final short EL_TEXT = 29;
- static final short EL_TITLE = 30;
- static final short EL_USE = 31;
-
- //--------------------------------------------------
- // STATIC CONSTANTS - SVGT Attribute ids
- //--------------------------------------------------
- static final short AT_UNDEFINED = -1;
- static final short AT_ACCENTHEIGHT = 50;
- static final short AT_ACCUMULATE = 51;
- static final short AT_ADDITIVE = 52;
- static final short AT_ALPHABETIC = 53;
- static final short AT_ARABICFORM = 54;
- static final short AT_ASCENT = 55;
- static final short AT_ATTRIBUTENAME = 56;
- static final short AT_ATTRIBUTETYPE = 57;
- static final short AT_BASEPROFILE = 58;
- static final short AT_BBOX = 59;
- static final short AT_BEGIN = 60;
- static final short AT_BY = 61;
- static final short AT_CALCMODE = 62;
- static final short AT_CAPHEIGHT = 63;
- static final short AT_COLOR = 64;
- static final short AT_COLORRENDERING = 65;
- // static final short AT_CONTENT = 66;
- static final short AT_CX = 67;
- static final short AT_CY = 68;
- static final short AT_D = 69;
- static final short AT_DESCENT = 70;
- static final short AT_DISPLAY = 71;
- static final short AT_DUR = 72;
- static final short AT_END = 73;
- static final short AT_FILL = 74;
- static final short AT_FILLRULE = 75;
- static final short AT_FONTFAMILY = 76;
- static final short AT_FONTSIZE = 77;
- static final short AT_FONTSTRETCH = 78;
- static final short AT_FONTSTYLE = 79;
- static final short AT_FONTVARIANT = 80;
- static final short AT_FONTWEIGHT = 81;
- static final short AT_FROM = 82;
- static final short AT_G1 = 83;
- static final short AT_G2 = 84;
- static final short AT_GLYPHNAME = 85;
- static final short AT_HANGING = 86;
- static final short AT_HEIGHT = 87;
- static final short AT_HORIZADVX = 88;
- static final short AT_HORIZORIGINX = 89;
- static final short AT_ID = 90;
- static final short AT_IDEOGRAPHIC = 91;
- static final short AT_K = 92;
- static final short AT_KEYPOINTS = 93;
- static final short AT_KEYSPLINES = 94;
- static final short AT_KEYTIMES = 95;
- static final short AT_LANG = 96;
- static final short AT_MATHEMATICAL = 97;
- static final short AT_MAX = 98;
- static final short AT_MIN = 99;
- static final short AT_NAME = 100;
- static final short AT_ORIGIN = 101;
- static final short AT_OVERLINEPOSITION = 102;
- static final short AT_OVERLINETHICKNESS = 103;
- static final short AT_PANOSE1 = 104;
- static final short AT_PATH = 105;
- static final short AT_PATHLENGTH = 106;
- static final short AT_POINTS = 107;
- static final short AT_PRESERVEASPECTRATIO = 108;
- static final short AT_R = 109;
- static final short AT_REPEATCOUNT = 110;
- static final short AT_REPEATDUR = 111;
- static final short AT_REQUIREDEXTENSIONS = 112;
- static final short AT_REQUIREDFEATURES = 113;
- static final short AT_RESTART = 114;
- static final short AT_ROTATE = 115;
- static final short AT_RX = 116;
- static final short AT_RY = 117;
- static final short AT_SLOPE = 118;
- static final short AT_STEMH = 119;
- static final short AT_STEMV = 120;
- static final short AT_STRIKETHROUGHPOSITION = 121;
- static final short AT_STRIKETHROUGHTHICKNESS = 122;
- static final short AT_STROKE = 123;
- static final short AT_STROKEDASHARRAY = 124;
- static final short AT_STROKEDASHOFFSET = 125;
- static final short AT_STROKELINECAP = 126;
- static final short AT_STROKELINEJOIN = 127;
- static final short AT_STROKEMITERLIMIT = 128;
- static final short AT_STROKEWIDTH = 129;
- static final short AT_STYLE = 130;
- static final short AT_SYSTEMLANGUAGE = 131;
- static final short AT_TARGET = 132;
- static final short AT_TEXTANCHOR = 133;
- static final short AT_TO = 134;
- static final short AT_TRANSFORM = 135;
- static final short AT_TYPE = 136;
- static final short AT_U1 = 137;
- static final short AT_U2 = 138;
- static final short AT_UNDERLINEPOSITION = 139;
- static final short AT_UNDERLINETHICKNESS = 140;
- static final short AT_UNICODE = 141;
- static final short AT_UNICODERANGE = 142;
- static final short AT_UNITSPEREM = 143;
- static final short AT_VALUES = 144;
- static final short AT_VERSION = 145;
- static final short AT_VIEWBOX = 146;
- static final short AT_VISIBILITY = 147;
- static final short AT_WIDTH = 148;
- static final short AT_WIDTHS = 149;
- static final short AT_X = 150;
- static final short AT_XHEIGHT = 151;
- static final short AT_X1 = 152;
- static final short AT_X2 = 153;
- static final short AT_XLINKACTUATE = 154;
- static final short AT_XLINKARCROLE = 155;
- static final short AT_XLINKHREF = 156;
- static final short AT_XLINKROLE = 157;
- static final short AT_XLINKSHOW = 158;
- static final short AT_XLINKTITLE = 159;
- static final short AT_XLINKTYPE = 160;
- static final short AT_XMLBASE = 161;
- static final short AT_XMLLANG = 162;
- static final short AT_XMLSPACE = 163;
- static final short AT_Y = 164;
- static final short AT_Y1 = 165;
- static final short AT_Y2 = 166;
- static final short AT_ZOOMANDPAN = 167;
- // not in the spec but used to correctly implement animateMotion
- static final short AT_MOTIONTRANSFORM = 168;
- // not actually an attribute, but needed for desc, title, and text
- static final short AT_STRING = 169;
- static final short AT_TEXTDECORATION = 170;
- static final short AT_HORIZORIGINY = 171;
- static final short AT_MOUSEEVENT = 172;
- static final short AT_USERBBOX = 173;
-
- //--------------------------------------------------
- // STATIC CONSTANTS - Error flags
- //--------------------------------------------------
- static final short DEFAULT_INHERIT = -2; // = null on native engine;
- static final short SVG_ERROR = -1;
- static final short TEXT_NOT_SHORT = -3;
-
- //--------------------------------------------------
- // STATIC CONSTANTS - A constant for each type of value
- //--------------------------------------------------
- static final short VAL_EVENT = 200;
- static final short VAL_INTEGER = 201;
- static final short VAL_PAINT = 202;
- static final short VAL_POINT = 203;
- static final short VAL_REAL = 204;
- static final short VAL_STRING = 205;
- static final short VAL_TIME = 206;
- static final short VAL_TRANSFORM = 207;
- static final short VAL_VECTOR = 208;
- // These are used for animation purposes
- static final short VAL_VECTOR_POINT = 215;
- static final short VAL_VECTOR_REAL = 216;
- static final short VAL_VECTOR_STRING = 217;
- static final short VAL_VECTOR_PATH = 218;
- // VAL_VECTOR_X + VECTOR_TO_VAL = VAL_X
- static final short VECTOR_TO_VAL = -12;
-
- //--------------------------------------------------
- // STATIC CONSTANTS - Constants for "choices"
- //--------------------------------------------------
- // Preserve aspect ratio constants
- static final short PAR_NONE = 310;
- static final short PAR_XMIDYMID = 311;
- // Zoom and pan constants
- static final short ZPN_MAGNIFY = 320;
- static final short ZPN_DISABLE = 321;
- // Paint
- static final short PAINT_NONE = 325;
- static final short PAINT_CURRENT = 326;
- static final short PAINT_COLOR = 327;
- static final short PAINT_INHERIT = 328;
- // Fonts
- static final short FONT_ALL = 330;
- static final short FONT_NORMAL = 331;
- static final short FONT_STYLE_ITALIC = 332;
- static final short FONT_STYLE_OBLIQUE = 333;
- static final short FONT_VARIANT_SMALLCAPS = 334;
- static final short FONT_WEIGHT_BOLD = 335;
- static final short FONT_WEIGHT_BOLDER = 336;
- static final short FONT_WEIGHT_LIGHTER = 337;
- static final short FONT_WEIGHT_100 = 338;
- static final short FONT_WEIGHT_200 = 339;
- static final short FONT_WEIGHT_300 = 340;
- static final short FONT_WEIGHT_400 = 341;
- static final short FONT_WEIGHT_500 = 342;
- static final short FONT_WEIGHT_600 = 343;
- static final short FONT_WEIGHT_700 = 344;
- static final short FONT_WEIGHT_800 = 345;
- static final short FONT_WEIGHT_900 = 346;
- static final short FONT_STRETCH_WIDER = 347;
- static final short FONT_STRETCH_NARROWER = 348;
- static final short FONT_STRETCH_ULTRA_COND = 349;
- static final short FONT_STRETCH_EXTRA_COND = 350;
- static final short FONT_STRETCH_COND = 351;
- static final short FONT_STRETCH_SEMI_COND = 352;
- static final short FONT_STRETCH_SEMI_EXPD = 353;
- static final short FONT_STRETCH_EXPD = 354;
- static final short FONT_STRETCH_EXTRA_EXPD = 355;
- static final short FONT_STRETCH_ULTRA_EXPD = 356;
- // Text
- static final short TEXT_ANCHOR_START = 360;
- static final short TEXT_ANCHOR_MIDDLE = 361;
- static final short TEXT_ANCHOR_END = 362;
- static final short TEXT_UNDER_LINE = 363;
- static final short TEXT_OVER_LINE = 364;
- static final short TEXT_LINE_THROUGH = 365;
- // These are actual sizes in 8:8 fixed point, not "choices"
- static final int FONT_SIZE_XXSMALL = 0x20000;
- static final int FONT_SIZE_XSMALL = 0x40000;
- static final int FONT_SIZE_SMALL = 0x60000;
- static final int FONT_SIZE_MEDIUM = 0xa0000;
- static final int FONT_SIZE_LARGE = 0x100000;
- static final int FONT_SIZE_XLARGE = 0x140000;
- static final int FONT_SIZE_XXLARGE = 0x180000;
-
- //--------------------------------------------------
- // STATIC CONSTANTS - Styles
- //--------------------------------------------------
- // Fill
- static final short FILL_RULE_EVENODD = 375;
- static final short FILL_RULE_NONZERO = 376;
- // Display
- static final short DISPLAY_NONE = 380;
- static final short DISPLAY_OTHER = 381;
- // Visibility
- static final short VISIBILITY_VISIBLE = 385;
- static final short VISIBILITY_OTHER = 386;
- // Color-rendering
- static final short COLOR_RENDERING_AUTO = 390;
- static final short COLOR_RENDERING_SPEED = 391;
- static final short COLOR_RENDERING_QUALITY = 392;
- // Strokes
- // MUST PRESERVE ORDER!!
- static final short STROKE_LINECAP_BUTT = 395;
- static final short STROKE_LINECAP_ROUND = 396;
- static final short STROKE_LINECAP_SQUARE = 397;
- static final short STROKE_LINEJOIN_MITER = 400;
- static final short STROKE_LINEJOIN_ROUND = 401;
- static final short STROKE_LINEJOIN_BEVEL = 402;
-
- //--------------------------------------------------
- // STATIC CONSTANTS - Animation
- //--------------------------------------------------
- static final short ANIM_INDEFINITE = 445;
- static final short ACCUMULATE_NONE = 450;
- static final short ACCUMULATE_SUM = 451;
- static final short ADDITIVE_REPLACE = 455;
- static final short ADDITIVE_SUM = 456;
- static final short CALC_MODE_DISCRETE = 460;
- static final short CALC_MODE_LINEAR = 461;
- static final short CALC_MODE_PACED = 462;
- static final short CALC_MODE_SPLINE = 463;
- static final short FILL_REMOVE = 465;
- static final short FILL_FREEZE = 466;
- static final short RESTART_ALWAYS = 470;
- static final short RESTART_NEVER = 471;
- static final short RESTART_WHENNOTACTIVE = 472;
- static final short TYPE_TRANSLATE = 475;
- static final short TYPE_SCALE = 476;
- static final short TYPE_ROTATE = 477;
- static final short TYPE_SKEWX = 478;
- static final short TYPE_SKEWY = 479;
- static final short ATTR_TYPE_CSS = 485;
- static final short ATTR_TYPE_XML = 486;
- static final short ATTR_TYPE_AUTO = 487;
- static final short ROTATE_AUTO = 490;
- static final short ROTATE_AUTOREVERSE = 491;
- static final short ANIM_FROM_TO = 500;
- static final short ANIM_FROM_BY = 501;
- static final short ANIM_BY = 502;
- static final short ANIM_TO = 503;
- static final short ANIM_VALUES = 504;
- static final short ANIM_PATH = 505;
-
- //--------------------------------------------------
- // STATIC CONSTANTS - Path Commands
- //--------------------------------------------------
- static final short PATH_COMMAND_M = 600;
- static final short PATH_COMMAND_m = 601;
- static final short PATH_COMMAND_Z = 602;
- static final short PATH_COMMAND_L = 603;
- static final short PATH_COMMAND_l = 604;
- static final short PATH_COMMAND_H = 605;
- static final short PATH_COMMAND_h = 606;
- static final short PATH_COMMAND_V = 607;
- static final short PATH_COMMAND_v = 608;
- static final short PATH_COMMAND_C = 609;
- static final short PATH_COMMAND_c = 610;
- static final short PATH_COMMAND_S = 611;
- static final short PATH_COMMAND_s = 612;
- static final short PATH_COMMAND_Q = 613;
- static final short PATH_COMMAND_q = 614;
- static final short PATH_COMMAND_T = 615;
- static final short PATH_COMMAND_t = 616;
-
- //--------------------------------------------------
- // STATIC CONSTANTS - Events
- //--------------------------------------------------
- // Indicates that the animation has started
- static final short EVENT_BEGIN = 650;
- // Indicates that the animation has finished
- static final short EVENT_END = 651;
- // Indicates that the animation has repeated
- static final short EVENT_REPEAT = 652;
- static final short EVENT_BEGIN_EL = 653;
- static final short EVENT_END_EL = 654;
-
- //--------------------------------------------------
- // VARIABLES
- //--------------------------------------------------
- private static M2GSVGConstants sInstance = null;
-
- String iEmptySvgDocument = null;
- String iSvgBaseProfileName = null;
- String iSvgBaseProfileVersion = null;
- Hashtable iAllElements = null;
- Hashtable iAllAttributes = null;
- Vector iQualifiedElements = null;
- Vector iAnimatableElements = null;
- Vector iReadOnlyElements = null;
-
- //--------------------------------------------------
- // METHODS
- //--------------------------------------------------
- /**
- * Constructor
- */
- private M2GSVGConstants()
- {
- // Profile name
- iSvgBaseProfileName = System.getProperty("microedition.m2g.svg.baseProfile");
- // Profile version
- iSvgBaseProfileVersion = System.getProperty("microedition.m2g.svg.version");
-
- // Empty svg document
- // "<svg version=\"1.1\" baseProfile=\"tiny\" width=\"100\" height=\"100\"></svg>";
- StringBuffer buf = new StringBuffer();
- buf.append("<svg version=\"").append(iSvgBaseProfileVersion);
- buf.append("\" baseProfile=\"").append(iSvgBaseProfileName);
- buf.append("\" width=\"100\" height=\"100\"></svg>");
- iEmptySvgDocument = buf.toString();
-
- // Elements
- iAllElements = new Hashtable(32);
- iAllElements.put(new Short(EL_A), "a"); // 1
- iAllElements.put(new Short(EL_ANIMATE), "animate"); // 2
- iAllElements.put(new Short(EL_ANIMATECOLOR), "animateColor"); // 3
- iAllElements.put(new Short(EL_ANIMATEMOTION), "animateMotion"); // 4
- iAllElements.put(new Short(EL_ANIMATETRANSFORM), "animateTransform"); // 5
- iAllElements.put(new Short(EL_CIRCLE), "circle"); // 6
- iAllElements.put(new Short(EL_DEFS), "defs"); // 7
- iAllElements.put(new Short(EL_DESC), "desc"); // 8
- iAllElements.put(new Short(EL_ELLIPSE), "ellipse"); // 9
- iAllElements.put(new Short(EL_FONT), "font"); // 10
- iAllElements.put(new Short(EL_FONTFACE), "font-face"); // 11
- iAllElements.put(new Short(EL_FONTFACENAME), "font-face-name"); // 12
- iAllElements.put(new Short(EL_FONTFACESRC), "font-face-src"); // 13
- iAllElements.put(new Short(EL_FOREIGNOBJECT), "foreignObject"); // 14
- iAllElements.put(new Short(EL_G), "g"); // 15
- iAllElements.put(new Short(EL_GLYPH), "glyph"); // 16
- iAllElements.put(new Short(EL_HKERN), "hkern"); // 17
- iAllElements.put(new Short(EL_IMAGE), "image"); // 18
- iAllElements.put(new Short(EL_LINE), "line"); // 19
- iAllElements.put(new Short(EL_METADATA), "metadata"); // 20
- iAllElements.put(new Short(EL_MISSINGGLYPH), "missing-glyph"); // 21
- iAllElements.put(new Short(EL_MPATH), "mpath"); // 22
- iAllElements.put(new Short(EL_PATH), "path"); // 23
- iAllElements.put(new Short(EL_POLYGON), "polygon"); // 24
- iAllElements.put(new Short(EL_POLYLINE), "polyline"); // 25
- iAllElements.put(new Short(EL_RECT), "rect"); // 26
- iAllElements.put(new Short(EL_SET), "set"); // 27
- iAllElements.put(new Short(EL_SVG), "svg"); // 28
- iAllElements.put(new Short(EL_SWITCH), "switch"); // 29
- iAllElements.put(new Short(EL_TEXT), "text"); // 30
- iAllElements.put(new Short(EL_TITLE), "title"); // 31
- iAllElements.put(new Short(EL_USE), "use"); // 32
-
- // Attributes
- iAllAttributes = new Hashtable(118);
- iAllAttributes.put(new Short(AT_STRING), "#text"); // 1
- iAllAttributes.put(new Short(AT_ACCENTHEIGHT), "accent-heigh"); // 2
- iAllAttributes.put(new Short(AT_ACCUMULATE), "accumulate"); // 3
- iAllAttributes.put(new Short(AT_ADDITIVE), "additive"); // 4
- iAllAttributes.put(new Short(AT_ALPHABETIC), "alphabetic"); // 5
- iAllAttributes.put(new Short(AT_ARABICFORM), "arabic-form"); // 6
- iAllAttributes.put(new Short(AT_ASCENT), "ascent"); // 7
- iAllAttributes.put(new Short(AT_ATTRIBUTENAME), "attributeName"); // 8
- iAllAttributes.put(new Short(AT_ATTRIBUTETYPE), "attributeType"); // 9
- iAllAttributes.put(new Short(AT_BASEPROFILE), "baseProfile"); // 10
- iAllAttributes.put(new Short(AT_BBOX), "bbox"); // 11
- iAllAttributes.put(new Short(AT_BEGIN), "begin"); // 12
- iAllAttributes.put(new Short(AT_BY), "by"); // 13
- iAllAttributes.put(new Short(AT_CALCMODE), "calcMode"); // 14
- iAllAttributes.put(new Short(AT_CAPHEIGHT), "cap-height"); // 15
- iAllAttributes.put(new Short(AT_COLOR), "color"); // 16
- iAllAttributes.put(new Short(AT_COLORRENDERING), "color-rendering"); // 17
- iAllAttributes.put(new Short(AT_CX), "cx"); // 18
- iAllAttributes.put(new Short(AT_CY), "cy"); // 19
- iAllAttributes.put(new Short(AT_D), "d"); // 20
- iAllAttributes.put(new Short(AT_DESCENT), "descent"); // 21
- iAllAttributes.put(new Short(AT_DISPLAY), "display"); // 22
- iAllAttributes.put(new Short(AT_DUR), "dur"); // 23
- iAllAttributes.put(new Short(AT_END), "end"); // 24
- iAllAttributes.put(new Short(AT_FILL), "fill"); // 25
- iAllAttributes.put(new Short(AT_FILLRULE), "fill-rule"); // 26
- iAllAttributes.put(new Short(AT_FONTFAMILY), "font-family"); // 27
- iAllAttributes.put(new Short(AT_FONTSIZE), "font-size"); // 28
- iAllAttributes.put(new Short(AT_FONTSTRETCH), "font-stretch"); // 29
- iAllAttributes.put(new Short(AT_FONTSTYLE), "font-style"); // 30
- iAllAttributes.put(new Short(AT_FONTVARIANT), "font-variant"); // 31
- iAllAttributes.put(new Short(AT_FONTWEIGHT), "font-weight"); // 32
- iAllAttributes.put(new Short(AT_FROM), "from"); // 33
- iAllAttributes.put(new Short(AT_G1), "g1"); // 34
- iAllAttributes.put(new Short(AT_G2), "g2"); // 35
- iAllAttributes.put(new Short(AT_GLYPHNAME), "glyph-name"); // 36
- iAllAttributes.put(new Short(AT_HANGING), "hanging"); // 37
- iAllAttributes.put(new Short(AT_HEIGHT), "height"); // 38
- iAllAttributes.put(new Short(AT_HORIZADVX), "horiz-adv-x"); // 39
- iAllAttributes.put(new Short(AT_HORIZORIGINX), "horiz-origin-x"); // 40
- iAllAttributes.put(new Short(AT_ID), "id"); // 41
- iAllAttributes.put(new Short(AT_IDEOGRAPHIC), "ideographic"); // 42
- iAllAttributes.put(new Short(AT_K), "k"); // 43
- iAllAttributes.put(new Short(AT_KEYPOINTS), "keyPoints"); // 44
- iAllAttributes.put(new Short(AT_KEYSPLINES), "keySplines"); // 45
- iAllAttributes.put(new Short(AT_KEYTIMES), "keyTimes"); // 46
- iAllAttributes.put(new Short(AT_LANG), "lang"); // 47
- iAllAttributes.put(new Short(AT_MATHEMATICAL), "mathematical"); // 48
- iAllAttributes.put(new Short(AT_MAX), "max"); // 49
- iAllAttributes.put(new Short(AT_MIN), "min"); // 50
- iAllAttributes.put(new Short(AT_NAME), "name"); // 51
- iAllAttributes.put(new Short(AT_ORIGIN), "origin"); // 52
- iAllAttributes.put(new Short(AT_OVERLINEPOSITION), "overline-position"); // 53
- iAllAttributes.put(new Short(AT_OVERLINETHICKNESS), "overline-thickness"); // 54
- iAllAttributes.put(new Short(AT_PANOSE1), "panose-1"); // 55
- iAllAttributes.put(new Short(AT_PATH), "path"); // 56
- iAllAttributes.put(new Short(AT_PATHLENGTH), "pathLength"); // 57
- iAllAttributes.put(new Short(AT_POINTS), "points"); // 58
- iAllAttributes.put(new Short(AT_PRESERVEASPECTRATIO), "preserveAspectRatio"); // 59
- iAllAttributes.put(new Short(AT_R), "r"); // 60
- iAllAttributes.put(new Short(AT_REPEATCOUNT), "repeatCount"); // 61
- iAllAttributes.put(new Short(AT_REPEATDUR), "repeatDur"); // 62
- iAllAttributes.put(new Short(AT_REQUIREDEXTENSIONS), "requiredExtensions"); // 63
- iAllAttributes.put(new Short(AT_REQUIREDFEATURES), "requiredFeatures"); // 64
- iAllAttributes.put(new Short(AT_RESTART), "restart"); // 65
- iAllAttributes.put(new Short(AT_ROTATE), "rotate"); // 66
- iAllAttributes.put(new Short(AT_RX), "rx"); // 67
- iAllAttributes.put(new Short(AT_RY), "ry"); // 68
- iAllAttributes.put(new Short(AT_SLOPE), "slope"); // 69
- iAllAttributes.put(new Short(AT_STEMH), "stemh"); // 70
- iAllAttributes.put(new Short(AT_STEMV), "stemv"); // 71
- iAllAttributes.put(new Short(AT_STRIKETHROUGHPOSITION), "strikethrough-position"); // 72
- iAllAttributes.put(new Short(AT_STRIKETHROUGHTHICKNESS), "strikethrough-thickness"); // 73
- iAllAttributes.put(new Short(AT_STROKE), "stroke"); // 74
- iAllAttributes.put(new Short(AT_STROKEDASHARRAY), "stroke-dasharray"); // 75
- iAllAttributes.put(new Short(AT_STROKEDASHOFFSET), "stroke-dashoffset"); // 76
- iAllAttributes.put(new Short(AT_STROKELINECAP), "stroke-linecap"); // 77
- iAllAttributes.put(new Short(AT_STROKELINEJOIN), "stroke-linejoin"); // 78
- iAllAttributes.put(new Short(AT_STROKEMITERLIMIT), "stroke-miterlimit"); // 79
- iAllAttributes.put(new Short(AT_STROKEWIDTH), "stroke-width"); // 80
- iAllAttributes.put(new Short(AT_STYLE), "style"); // 81
- iAllAttributes.put(new Short(AT_SYSTEMLANGUAGE), "systemLanguage"); // 82
- iAllAttributes.put(new Short(AT_TARGET), "target"); // 83
- iAllAttributes.put(new Short(AT_TEXTANCHOR), "text-anchor"); // 84
- iAllAttributes.put(new Short(AT_TO), "to"); // 85
- iAllAttributes.put(new Short(AT_TRANSFORM), "transform"); // 86
- iAllAttributes.put(new Short(AT_TYPE), "type"); // 87
- iAllAttributes.put(new Short(AT_U1), "u1"); // 88
- iAllAttributes.put(new Short(AT_U2), "u2"); // 89
- iAllAttributes.put(new Short(AT_UNDERLINEPOSITION), "underline-position"); // 90
- iAllAttributes.put(new Short(AT_UNDERLINETHICKNESS), "underline-thickness"); // 91
- iAllAttributes.put(new Short(AT_UNICODE), "unicode"); // 92
- iAllAttributes.put(new Short(AT_UNICODERANGE), "unicode-range"); // 93
- iAllAttributes.put(new Short(AT_UNITSPEREM), "units-per-em"); // 94
- iAllAttributes.put(new Short(AT_VALUES), "values"); // 95
- iAllAttributes.put(new Short(AT_VERSION), "version"); // 96
- iAllAttributes.put(new Short(AT_VIEWBOX), "viewBox"); // 97
- iAllAttributes.put(new Short(AT_VISIBILITY), "visibility"); // 98
- iAllAttributes.put(new Short(AT_WIDTH), "width"); // 99
- iAllAttributes.put(new Short(AT_WIDTHS), "widths"); // 100
- iAllAttributes.put(new Short(AT_X), "x"); // 101
- iAllAttributes.put(new Short(AT_XHEIGHT), "xheight"); // 102
- iAllAttributes.put(new Short(AT_X1), "x1"); // 103
- iAllAttributes.put(new Short(AT_X2), "x2"); // 104
- iAllAttributes.put(new Short(AT_XLINKACTUATE), "xlink:actuate"); // 105
- iAllAttributes.put(new Short(AT_XLINKARCROLE), "xlink:arcrole"); // 106
- iAllAttributes.put(new Short(AT_XMLBASE), "xlink:base"); // 107
- iAllAttributes.put(new Short(AT_XLINKHREF), "xlink:href"); // 108
- iAllAttributes.put(new Short(AT_XLINKROLE), "xlink:role"); // 109
- iAllAttributes.put(new Short(AT_XLINKSHOW), "xlink:show"); // 110
- iAllAttributes.put(new Short(AT_XLINKTITLE), "xlink:title"); // 111
- iAllAttributes.put(new Short(AT_XLINKTYPE), "xlink:type"); // 112
- iAllAttributes.put(new Short(AT_XMLLANG), "xml:lang"); // 113
- iAllAttributes.put(new Short(AT_XMLSPACE), "xml:space"); // 114
- iAllAttributes.put(new Short(AT_Y), "y"); // 115
- iAllAttributes.put(new Short(AT_Y1), "y1"); // 116
- iAllAttributes.put(new Short(AT_Y2), "y2"); // 117
- iAllAttributes.put(new Short(AT_ZOOMANDPAN), "zoomAndPan"); // 118
-
- // Qualified elements
- iQualifiedElements = new Vector(10);
- iQualifiedElements.addElement("a"); // 1
- iQualifiedElements.addElement("circle"); // 2
- iQualifiedElements.addElement("ellipse"); // 3
- iQualifiedElements.addElement("g"); // 4
- iQualifiedElements.addElement("image"); // 5
- iQualifiedElements.addElement("line"); // 6
- iQualifiedElements.addElement("path"); // 7
- iQualifiedElements.addElement("rect"); // 8
- iQualifiedElements.addElement("text"); // 9
- iQualifiedElements.addElement("use"); // 10
-
- // Animatable elements
- iAnimatableElements = new Vector(6);
- iAnimatableElements.addElement("animate"); // 1
- iAnimatableElements.addElement("animateColor"); // 2
- iAnimatableElements.addElement("animateMotion"); // 3
- iAnimatableElements.addElement("animateTransform"); // 4
- iAnimatableElements.addElement("mpath"); // 5
- iAnimatableElements.addElement("set"); // 6
-
- // Read only elements
- iReadOnlyElements = new Vector(19);
- iReadOnlyElements.addElement("animateColor"); // 1
- iReadOnlyElements.addElement("animateMotion"); // 2
- iReadOnlyElements.addElement("animateTransform"); // 3
- iReadOnlyElements.addElement("defs"); // 4
- iReadOnlyElements.addElement("desc"); // 5
- iReadOnlyElements.addElement("font"); // 6
- iReadOnlyElements.addElement("font-face"); // 7
- iReadOnlyElements.addElement("font-face-name"); // 8
- iReadOnlyElements.addElement("font-face-src"); // 9
- iReadOnlyElements.addElement("foreignObject"); // 10
- iReadOnlyElements.addElement("glyph"); // 11
- iReadOnlyElements.addElement("hkern"); // 12
- iReadOnlyElements.addElement("metadata"); // 13
- iReadOnlyElements.addElement("missing-glyph"); // 14
- iReadOnlyElements.addElement("mpath"); // 15
- iReadOnlyElements.addElement("polygon"); // 16
- iReadOnlyElements.addElement("polyline"); // 17
- iReadOnlyElements.addElement("set"); // 18
- iReadOnlyElements.addElement("switch"); // 19
- }
-
- //--------------------------------------------------
- // STATIC METHODS
- //--------------------------------------------------
- /**
- * Determines if the specified parentElement can have the specified childElement.
- * This method works for only the element types that can be added in JSR-226.
- */
- static final boolean checkElementAsChild(short aParentElement, short aChildElement)
- {
- switch (aParentElement)
- {
- case EL_A:
- switch (aChildElement)
- {
- case EL_A:
- case EL_CIRCLE:
- case EL_ELLIPSE:
- case EL_G:
- case EL_IMAGE:
- case EL_LINE:
- case EL_PATH:
- case EL_RECT:
- case EL_TEXT:
- case EL_USE:
- return true;
- default:
- return false;
- }
-
- case EL_ANIMATE:
- case EL_ANIMATECOLOR:
- case EL_ANIMATEMOTION:
- case EL_ANIMATETRANSFORM:
- case EL_CIRCLE:
- return false;
-
- case EL_DEFS:
- switch (aChildElement)
- {
- case EL_A:
- case EL_CIRCLE:
- case EL_ELLIPSE:
- case EL_G:
- case EL_IMAGE:
- case EL_LINE:
- case EL_PATH:
- case EL_RECT:
- case EL_TEXT:
- case EL_USE:
- return true;
- default:
- return false;
- }
-
- case EL_DESC:
- case EL_ELLIPSE:
- case EL_FONT:
- case EL_FONTFACE:
- case EL_FONTFACENAME:
- case EL_FONTFACESRC:
- case EL_FOREIGNOBJECT:
- return false;
-
- case EL_G:
- switch (aChildElement)
- {
- case EL_A:
- case EL_CIRCLE:
- case EL_ELLIPSE:
- case EL_G:
- case EL_IMAGE:
- case EL_LINE:
- case EL_PATH:
- case EL_RECT:
- case EL_TEXT:
- case EL_USE:
- return true;
- default:
- return false;
- }
-
- case EL_GLYPH:
- case EL_HKERN:
- case EL_IMAGE:
- case EL_LINE:
- case EL_METADATA:
- case EL_MISSINGGLYPH:
- case EL_MPATH:
- case EL_PATH:
- case EL_POLYGON:
- case EL_POLYLINE:
- case EL_RECT:
- case EL_SET:
- return false;
-
- case EL_SVG:
- case EL_SWITCH:
- switch (aChildElement)
- {
- case EL_A:
- case EL_CIRCLE:
- case EL_ELLIPSE:
- case EL_G:
- case EL_IMAGE:
- case EL_LINE:
- case EL_PATH:
- case EL_RECT:
- case EL_TEXT:
- case EL_USE:
- return true;
- default:
- return false;
- }
-
- case EL_TEXT:
- switch (aChildElement)
- {
- case EL_A:
- return true;
- default:
- return false;
- }
-
- case EL_TITLE:
- case EL_USE:
- default:
- return false;
- }
- }
-
- /**
- * Determines if the specified attribute type can be set on the specified element type.
- * @param aAttribute
- * @param aElement
- * @return true if ok
- */
- static final boolean checkElementAttribute(short aAttribute, short aElement)
- {
- switch (aElement)
- {
- case EL_A:
- switch (aAttribute)
- {
- case AT_COLOR:
- case AT_DISPLAY:
- case AT_FILL:
- case AT_FILLRULE:
- case AT_STROKE:
- case AT_STROKEDASHOFFSET:
- case AT_STROKELINECAP:
- case AT_STROKELINEJOIN:
- case AT_STROKEMITERLIMIT:
- case AT_STROKEWIDTH:
- case AT_VISIBILITY:
- case AT_FONTFAMILY:
- case AT_FONTSIZE:
- case AT_FONTSTYLE:
- case AT_FONTWEIGHT:
- case AT_TEXTANCHOR:
- case AT_TRANSFORM:
- case AT_TARGET:
- case AT_XLINKHREF:
- return true;
- default:
- return false;
- }
- case EL_CIRCLE:
- switch (aAttribute)
- {
- case AT_COLOR:
- case AT_DISPLAY:
- case AT_FILL:
- case AT_FILLRULE:
- case AT_STROKE:
- case AT_STROKEDASHOFFSET:
- case AT_STROKELINECAP:
- case AT_STROKELINEJOIN:
- case AT_STROKEMITERLIMIT:
- case AT_STROKEWIDTH:
- case AT_VISIBILITY:
- case AT_TRANSFORM:
- case AT_CX:
- case AT_CY:
- case AT_R:
- return true;
- default:
- return false;
- }
- case EL_ELLIPSE:
- switch (aAttribute)
- {
- case AT_COLOR:
- case AT_DISPLAY:
- case AT_FILL:
- case AT_FILLRULE:
- case AT_STROKE:
- case AT_STROKEDASHOFFSET:
- case AT_STROKELINECAP:
- case AT_STROKELINEJOIN:
- case AT_STROKEMITERLIMIT:
- case AT_STROKEWIDTH:
- case AT_VISIBILITY:
- case AT_TRANSFORM:
- case AT_CX:
- case AT_CY:
- case AT_RX:
- case AT_RY:
- return true;
- default:
- return false;
- }
- case EL_G:
- switch (aAttribute)
- {
- case AT_COLOR:
- case AT_DISPLAY:
- case AT_FILL:
- case AT_FILLRULE:
- case AT_STROKE:
- case AT_STROKEDASHOFFSET:
- case AT_STROKELINECAP:
- case AT_STROKELINEJOIN:
- case AT_STROKEMITERLIMIT:
- case AT_STROKEWIDTH:
- case AT_VISIBILITY:
- case AT_FONTFAMILY:
- case AT_FONTSIZE:
- case AT_FONTSTYLE:
- case AT_FONTWEIGHT:
- case AT_TEXTANCHOR:
- case AT_TRANSFORM:
- return true;
- default:
- return false;
- }
- case EL_IMAGE:
- switch (aAttribute)
- {
- case AT_COLOR:
- case AT_DISPLAY:
- case AT_FILL:
- case AT_FILLRULE:
- case AT_STROKE:
- case AT_STROKEDASHOFFSET:
- case AT_STROKELINECAP:
- case AT_STROKELINEJOIN:
- case AT_STROKEMITERLIMIT:
- case AT_STROKEWIDTH:
- case AT_VISIBILITY:
- case AT_TRANSFORM:
- case AT_X:
- case AT_Y:
- case AT_WIDTH:
- case AT_HEIGHT:
- case AT_XLINKHREF:
- return true;
- default:
- return false;
- }
- case EL_LINE:
- switch (aAttribute)
- {
- case AT_COLOR:
- case AT_DISPLAY:
- case AT_FILL:
- case AT_FILLRULE:
- case AT_STROKE:
- case AT_STROKEDASHOFFSET:
- case AT_STROKELINECAP:
- case AT_STROKELINEJOIN:
- case AT_STROKEMITERLIMIT:
- case AT_STROKEWIDTH:
- case AT_VISIBILITY:
- case AT_TRANSFORM:
- case AT_X1:
- case AT_X2:
- case AT_Y1:
- case AT_Y2:
- return true;
- default:
- return false;
- }
- case EL_PATH:
- switch (aAttribute)
- {
- case AT_COLOR:
- case AT_DISPLAY:
- case AT_FILL:
- case AT_FILLRULE:
- case AT_STROKE:
- case AT_STROKEDASHOFFSET:
- case AT_STROKELINECAP:
- case AT_STROKELINEJOIN:
- case AT_STROKEMITERLIMIT:
- case AT_STROKEWIDTH:
- case AT_VISIBILITY:
- case AT_TRANSFORM:
- case AT_D:
- return true;
- default:
- return false;
- }
- case EL_RECT:
- switch (aAttribute)
- {
- case AT_COLOR:
- case AT_DISPLAY:
- case AT_FILL:
- case AT_FILLRULE:
- case AT_STROKE:
- case AT_STROKEDASHOFFSET:
- case AT_STROKELINECAP:
- case AT_STROKELINEJOIN:
- case AT_STROKEMITERLIMIT:
- case AT_STROKEWIDTH:
- case AT_VISIBILITY:
- case AT_TRANSFORM:
- case AT_HEIGHT:
- case AT_WIDTH:
- case AT_X:
- case AT_Y:
- case AT_RX:
- case AT_RY:
- return true;
- default:
- return false;
- }
- case EL_SVG:
- switch (aAttribute)
- {
- case AT_COLOR:
- case AT_DISPLAY:
- case AT_FILL:
- case AT_FILLRULE:
- case AT_STROKE:
- case AT_STROKEDASHOFFSET:
- case AT_STROKELINECAP:
- case AT_STROKELINEJOIN:
- case AT_STROKEMITERLIMIT:
- case AT_STROKEWIDTH:
- case AT_VISIBILITY:
- case AT_FONTFAMILY:
- case AT_FONTSIZE:
- case AT_FONTSTYLE:
- case AT_FONTWEIGHT:
- case AT_TEXTANCHOR:
- case AT_VERSION:
- case AT_BASEPROFILE:
- case AT_VIEWBOX:
- case AT_ZOOMANDPAN:
- return true;
- default:
- return false;
- }
- case EL_TEXT:
- switch (aAttribute)
- {
- case AT_COLOR:
- case AT_DISPLAY:
- case AT_FILL:
- case AT_FILLRULE:
- case AT_STROKE:
- case AT_STROKEDASHOFFSET:
- case AT_STROKELINECAP:
- case AT_STROKELINEJOIN:
- case AT_STROKEMITERLIMIT:
- case AT_STROKEWIDTH:
- case AT_VISIBILITY:
- case AT_FONTFAMILY:
- case AT_FONTSIZE:
- case AT_FONTSTYLE:
- case AT_FONTWEIGHT:
- case AT_TEXTANCHOR:
- case AT_TRANSFORM:
- case AT_X:
- case AT_Y:
- case AT_STRING:
- return true;
- default:
- return false;
- }
- case EL_USE:
- switch (aAttribute)
- {
- case AT_COLOR:
- case AT_DISPLAY:
- case AT_FILL:
- case AT_FILLRULE:
- case AT_STROKE:
- case AT_STROKEDASHOFFSET:
- case AT_STROKELINECAP:
- case AT_STROKELINEJOIN:
- case AT_STROKEMITERLIMIT:
- case AT_STROKEWIDTH:
- case AT_VISIBILITY:
- case AT_FONTFAMILY:
- case AT_FONTSIZE:
- case AT_FONTSTYLE:
- case AT_FONTWEIGHT:
- case AT_TEXTANCHOR:
- case AT_TRANSFORM:
- case AT_X:
- case AT_Y:
- case AT_XLINKHREF:
- return true;
- default:
- return false;
- }
- default:
- return false;
- }
- }
-
- /**
- * Checks if the attribute name needs prefix
- * @param aAttributeTypeName
- * @return Attribute name
- */
- static final String checkPrefixNeed(String aAttributeTypeName)
- {
- if (aAttributeTypeName.equals("actuate")) return "xlink:actuate";
-
- else if (aAttributeTypeName.equals("arcrole")) return "xlink:arcrole";
-
- else if (aAttributeTypeName.equals("href")) return "xlink:href";
-
- else if (aAttributeTypeName.equals("role")) return "xlink:role";
-
- else if (aAttributeTypeName.equals("show")) return "xlink:show";
-
- else if (aAttributeTypeName.equals("title")) return "xlink:title";
-
- else if (aAttributeTypeName.equals("type")) return "xlink:type";
-
- else if (aAttributeTypeName.equals("base")) return "xml:base";
-
- else if (aAttributeTypeName.equals("lang")) return "xml:lang";
-
- else if (aAttributeTypeName.equals("space")) return "xml:space";
-
- else return aAttributeTypeName;
- }
-
- /**
- * Get internal data containers
- * @return Data containers
- */
- static M2GSVGConstants getInstance()
- {
- if (sInstance == null)
- {
-
- sInstance = new M2GSVGConstants();
- }
- return sInstance;
- }
-
- /**
- * Checks if element can be inserted.
- * @param aElementTypeId -
- * @return true if ok
- */
- static final boolean isAllowedToInsertElement(short aElementTypeId)
- {
- switch (aElementTypeId)
- {
- case EL_A:
- case EL_CIRCLE:
- case EL_ELLIPSE:
- case EL_G:
- case EL_IMAGE:
- case EL_LINE:
- case EL_PATH:
- case EL_RECT:
- case EL_TEXT:
- case EL_USE:
- return true;
- default:
- return false;
- }
- }
-
- /**
- * Checks if element can be removed.
- * @param aElementTypeId -
- * @return true if ok
- */
- static final boolean isAllowedToRemoveElement(short aElementTypeId)
- {
- switch (aElementTypeId)
- {
- case EL_A:
- case EL_CIRCLE:
- case EL_ELLIPSE:
- case EL_G:
- case EL_IMAGE:
- case EL_LINE:
- case EL_PATH:
- case EL_RECT:
- case EL_TEXT:
- case EL_USE:
- return true;
- default:
- return false;
- }
- }
-
- /**
- * Checks if element is animatable
- * @param aElementTypeName
- * @return true if element is animatable
- */
- static boolean isAnimatableElement(String aElementTypeName)
- {
- if (getInstance().iAnimatableElements.contains(
- aElementTypeName))
- {
- return true;
- }
- return false;
- }
-
- /**
- * Checks that float trait is allowed to get
- * @param aAttributeTypeId
- * @return true if float trait is allowed to get
- */
- static final boolean isGetFloatTraitAllowed(short aAttributeTypeId)
- {
- switch (aAttributeTypeId)
- {
- case AT_STROKEDASHOFFSET:
- case AT_STROKEMITERLIMIT:
- case AT_STROKEWIDTH:
- case AT_FONTSIZE:
- case AT_HEIGHT:
- case AT_WIDTH:
- case AT_X:
- case AT_Y:
- case AT_RX:
- case AT_RY:
- case AT_CX:
- case AT_CY:
- case AT_R:
- case AT_X1:
- case AT_X2:
- case AT_Y1:
- case AT_Y2:
- return true;
- default:
- return false;
- }
- }
-
- /**
- * Checks that matrix trait is allowed to set
- * @param aAttributeTypeId
- * @return true if matrix trait is allowed to set
- */
- static final boolean isGetMatrixTraitAllowed(short aAttributeTypeId)
- {
- switch (aAttributeTypeId)
- {
- case AT_TRANSFORM:
- return true;
- default:
- return false;
- }
- }
-
- /**
- * Checks that path trait is allowed to get
- * @param aAttributeTypeId
- * @return true if path trait is allowed to get
- */
- static final boolean isGetPathTraitAllowed(short aAttributeTypeId)
- {
- switch (aAttributeTypeId)
- {
- case AT_D:
- return true;
- default:
- return false;
- }
- }
-
- /**
- * Checks that rect trait is allowed to get
- * @param aAttributeTypeId
- * @return true if rect trait is allowed to get
- */
- static final boolean isGetRectTraitAllowed(short aAttributeTypeId)
- {
- switch (aAttributeTypeId)
- {
- case AT_VIEWBOX:
- return true;
- default:
- return false;
- }
- }
-
- /**
- * Checks that RGB trait is allowed to get.
- * @param aAttributeTypeId
- * @return true if RGB trait is allowed to get.
- */
- static final boolean isGetRgbColorTraitAllowed(short aAttributeTypeId)
- {
- switch (aAttributeTypeId)
- {
- case AT_COLOR:
- case AT_FILL:
- case AT_STROKE:
- return true;
- default:
- return false;
- }
- }
-
- /**
- * Checks that trait that can be obtained as a string is allowed to get.
- * In SVG Tiny only certain traits can be obtained as a String value.
- * @param aAttributeTypeId
- * @return true if ok
- */
- static final boolean isGetTraitNSStringAllowed(short aAttributeTypeId)
- {
- switch (aAttributeTypeId)
- {
- case AT_DISPLAY:
- case AT_FILLRULE:
- case AT_STROKELINECAP:
- case AT_STROKELINEJOIN:
- case AT_VISIBILITY:
- case AT_FONTFAMILY:
- case AT_FONTSTYLE:
- case AT_FONTWEIGHT:
- case AT_TEXTANCHOR:
- case AT_TARGET:
- case AT_STRING: // not an SVG aTrait, but represents the contents of <text>
- case AT_VERSION:
- case AT_BASEPROFILE:
- case AT_XLINKHREF:
- case AT_ZOOMANDPAN:
- return true;
- default:
- return false;
- }
- }
-
-
- /**
- * Check trait
- * @param aAttributeTypeId
- * @return
- */
- static final boolean isGetTraitNSAllowed(short aAttributeTypeId)
- {
- switch (aAttributeTypeId)
- {
- case AT_XLINKHREF:
- return true;
- default:
- return false;
- }
- }
-
- /**
- * Checks that an element is locatable
- * @param aElementTypeName
- * @return true if the element is locatable
- */
- static boolean isLocatableElement(String aElementTypeName)
- {
- if (isRootElement(aElementTypeName))
- {
- return true;
- }
- if (getInstance().iQualifiedElements.contains(
- aElementTypeName))
- {
- return true;
- }
- return false;
- }
-
- /**
- * Checks that an element is qualified
- * @param aElementTypeName
- * @return true if the element is qualified
- */
- static boolean isQualifiedElement(String aElementTypeName)
- {
- if (getInstance().iQualifiedElements.contains(
- aElementTypeName))
- {
- return true;
- }
- return false;
- }
-
- /**
- * Checks if element is read only
- * @param aElementTypeName
- * @return true if the element is read only
- */
- static boolean isElementReadOnly(String aElementTypeName)
- {
- if (aElementTypeName != null)
- {
- return getInstance().iReadOnlyElements.contains(
- aElementTypeName);
- }
- return false;
- }
-
- /**
- * Checks that an element is a root element
- * @param aElementTypeName
- * @return true if the element is a root element
- */
- static boolean isRootElement(String aElementTypeName)
- {
- return ROOT_SVG_ELEMENT_NAME.equals(aElementTypeName);
- }
-
- /**
- * Checks that float trait is allowed to set
- * @param aAttributeTypeId
- * @return true if float trait is allowed to set
- */
- static final boolean isSetFloatTraitAllowed(short aAttributeTypeId)
- {
- return isGetFloatTraitAllowed(aAttributeTypeId);
- }
-
- /**
- * Checks that matrix trait is allowed to set
- * @param aAttributeTypeId
- * @return true if matrix trait is allowed to set
- */
- static final boolean isSetMatrixTraitAllowed(short aAttributeTypeId)
- {
- return isGetMatrixTraitAllowed(aAttributeTypeId);
- }
-
-
- /**
- * Checks that path trait is allowed to set
- * @param aAttributeTypeId
- * @return true if path trait is allowed to set
- */
- static final boolean isSetPathTraitAllowed(short aAttributeTypeId)
- {
- return isGetPathTraitAllowed(aAttributeTypeId);
- }
-
- /**
- * Checks that rect trait is allowed to set
- * @param aAttributeTypeId
- * @return true if rect trait is allowed to set
- */
- static final boolean isSetRectTraitAllowed(short aAttributeTypeId)
- {
- switch (aAttributeTypeId)
- {
- case AT_VIEWBOX:
- return true;
- default:
- return false;
- }
- }
-
- /**
- * Checks that RGB trait is allowed to set.
- * @param aAttributeTypeId
- * @return true if RGB trait is allowed to set.
- */
- static final boolean isSetRgbColorTraitAllowed(short aAttributeTypeId)
- {
- switch (aAttributeTypeId)
- {
- case AT_COLOR:
- case AT_FILL:
- case AT_STROKE:
- return true;
- default:
- return false;
- }
- }
-
- /**
- * Checks that trait that can be obtained as a string is allowed to set.
- * In SVG Tiny only certain traits can be obtained as a String value.
- * @param aAttributeTypeId
- * @return true if ok
- */
- static final boolean isSetTraitNSStringAllowed(short aAttributeTypeId)
- {
- switch (aAttributeTypeId)
- {
- case AT_COLOR:
- case AT_DISPLAY:
- case AT_FILL:
- case AT_FILLRULE:
- case AT_STROKE:
- case AT_STROKEDASHOFFSET:
- case AT_STROKELINECAP:
- case AT_STROKELINEJOIN:
- case AT_STROKEMITERLIMIT:
- case AT_STROKEWIDTH:
- case AT_VISIBILITY:
- case AT_FONTFAMILY:
- case AT_FONTSIZE:
- case AT_FONTSTYLE:
- case AT_FONTWEIGHT:
- case AT_TEXTANCHOR:
- case AT_TARGET:
- case AT_STRING: // not an SVG trait, but represents the contents of <text>
- case AT_XLINKHREF:
- case AT_ZOOMANDPAN:
- return true;
- default:
- return false;
- }
- }
-
- /**
- * Check trait
- * @param aAttributeTypeId
- * @return
- */
- static final boolean isSetTraitNSAllowed(short aAttributeTypeId)
- {
- return isGetTraitNSAllowed(aAttributeTypeId);
- }
-
- /**
- * Converts a string trait name to the appropriate short constant.
- * This method covers all of SVGT 1.1 and not just JSR-226.
- * @param aAttributeTypeName
- * @return Attribute's type id
- */
- static final short parseAttributeTypeId(String aAttributeTypeName)
- {
- String name = checkPrefixNeed(aAttributeTypeName);
- Enumeration keys = getInstance().iAllAttributes.keys();
- while (keys.hasMoreElements())
- {
- Object id = keys.nextElement();
- try
- {
- if (((String)getInstance().iAllAttributes.get(
- id)).equals(name))
- {
- return ((Short)id).shortValue();
- }
- }
- catch (Exception e)
- {
- }
-
- }
- return SVG_ERROR;
- }
-
- /**
- * Converts a short constant to the string representation of a SVGT 1.1 trait name.
- * This method covers all of SVGT 1.1 and not just JSR-226.
- * @param aAttributeTypeId
- * @return Attribute's type name
- */
- static final String parseAttributeTypeName(short aAttributeTypeId)
- {
-
- Object attributeName = getInstance().iAllAttributes.get(
- new Short(aAttributeTypeId));
- if (attributeName != null)
- {
- return (String)attributeName;
- }
- return "";
- }
-
- /**
- * Converts a string element name to the appropriate short constant.
- * This method covers all of SVGT 1.1 and not just JSR-226.
- * @param aElementTypeName
- * @return Element's type id
- */
- static final short parseElementTypeId(String aElementTypeName)
- {
- Enumeration keys = getInstance().iAllElements.keys();
- while (keys.hasMoreElements())
- {
- Object id = keys.nextElement();
- try
- {
- if (((String)getInstance().iAllElements.get(
- id)).equals(aElementTypeName))
- {
- return ((Short)id).shortValue();
- }
- }
- catch (Exception e)
- {
- }
- }
- return SVG_ERROR;
- }
-
- /**
- * Converts a short constant to the string representation of a SVGT 1.1 element name.
- * This method covers all of SVGT 1.1 and not just JSR-226.
- * @param aElementTypeId
- * @return Element's type name
- */
- static final String parseElementTypeName(short aElementTypeId)
- {
- Object elementName = getInstance().iAllElements.get(
- new Short(aElementTypeId));
- if (elementName != null)
- {
- return (String)elementName;
- }
- return "";
- }
-
- /**
- * Converts a string trait value to the appropriate short constant.
- * NOTE: This method only handles traits that can be set as a string in JSR-226.
- * @param aAttributeTypeId
- * @param aValue
- * @return Value's id
- */
- static final short parseAttributeValueNameId(short aAttributeTypeId, String aValue)
- {
- switch (aAttributeTypeId)
- {
- case AT_STRING: // element content (i.e. <text>, etc.)
- return TEXT_NOT_SHORT;
-
- case AT_COLOR: // inherit
- if (aValue.equals("inherit")) return PAINT_INHERIT;
- else return SVG_ERROR;
-
- case AT_DISPLAY: // inline | none | inherit
- if (aValue.equals("none")) return DISPLAY_NONE;
- else if (aValue.equals("inline")) return DISPLAY_OTHER;
- else if (aValue.equals("inherit")) return DEFAULT_INHERIT;
- else return SVG_ERROR;
-
- case AT_FILL: // none | currentColor | inherit
- if (aValue.equals("none")) return PAINT_NONE;
- else if (aValue.equals("currentColor")) return PAINT_CURRENT;
- else if (aValue.equals("inherit")) return PAINT_INHERIT;
- else return SVG_ERROR;
-
- case AT_FILLRULE: // nonzero | evenodd | inherit
- if (aValue.equals("evenodd")) return FILL_RULE_EVENODD;
- else if (aValue.equals("nonzero")) return FILL_RULE_NONZERO;
- else if (aValue.equals("inherit")) return DEFAULT_INHERIT;
- else return SVG_ERROR;
-
- case AT_FONTFAMILY: // same syntax as font-family attribute
- if (aValue.equals("inherit")) return DEFAULT_INHERIT;
- else return TEXT_NOT_SHORT;
-
- case AT_FONTSIZE: // inherit
- if (aValue.equals("inherit")) return DEFAULT_INHERIT;
- else return SVG_ERROR;
-
- case AT_FONTSTYLE: // normal | italic | oblique | inherit
- if (aValue.equals("normal")) return FONT_NORMAL;
- else if (aValue.equals("italic")) return FONT_STYLE_ITALIC;
- else if (aValue.equals("oblique")) return FONT_STYLE_OBLIQUE;
- else if (aValue.equals("inherit")) return DEFAULT_INHERIT;
- else return SVG_ERROR;
-
- case AT_FONTWEIGHT: // normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | inherit
- if (aValue.equals("normal")) return FONT_NORMAL;
- else if (aValue.equals("bold")) return FONT_WEIGHT_BOLD;
- else if (aValue.equals("bolder")) return FONT_WEIGHT_BOLDER;
- else if (aValue.equals("lighter")) return FONT_WEIGHT_LIGHTER;
- else if (aValue.equals("100")) return FONT_WEIGHT_100;
- else if (aValue.equals("200")) return FONT_WEIGHT_200;
- else if (aValue.equals("300")) return FONT_WEIGHT_300;
- else if (aValue.equals("400")) return FONT_WEIGHT_400;
- else if (aValue.equals("500")) return FONT_WEIGHT_500;
- else if (aValue.equals("600")) return FONT_WEIGHT_600;
- else if (aValue.equals("700")) return FONT_WEIGHT_700;
- else if (aValue.equals("800")) return FONT_WEIGHT_800;
- else if (aValue.equals("900")) return FONT_WEIGHT_900;
- else if (aValue.equals("inherit")) return DEFAULT_INHERIT;
- else return SVG_ERROR;
-
- case AT_STROKE: // none | currentColor | inherit
- if (aValue.equals("none")) return PAINT_NONE;
- else if (aValue.equals("currentColor")) return PAINT_CURRENT;
- else if (aValue.equals("inherit")) return PAINT_INHERIT;
- else return SVG_ERROR;
-
- case AT_STROKEDASHOFFSET: // inherit
- if (aValue.equals("inherit")) return DEFAULT_INHERIT;
- else return SVG_ERROR;
-
- case AT_STROKELINECAP: // butt | round | square | inherit
- if (aValue.equals("butt")) return STROKE_LINECAP_BUTT;
- else if (aValue.equals("round")) return STROKE_LINECAP_ROUND;
- else if (aValue.equals("square")) return STROKE_LINECAP_SQUARE;
- else if (aValue.equals("inherit")) return DEFAULT_INHERIT;
- else return SVG_ERROR;
-
- case AT_STROKELINEJOIN: // miter | round | bevel | inherit
- if (aValue.equals("miter")) return STROKE_LINEJOIN_MITER;
- else if (aValue.equals("round")) return STROKE_LINEJOIN_ROUND;
- else if (aValue.equals("bevel")) return STROKE_LINEJOIN_BEVEL;
- else if (aValue.equals("inherit")) return DEFAULT_INHERIT;
- else return SVG_ERROR;
-
- case AT_STROKEMITERLIMIT: // inherit
- if (aValue.equals("inherit")) return DEFAULT_INHERIT;
- else return SVG_ERROR;
-
- case AT_STROKEWIDTH: // inherit
- if (aValue.equals("inherit")) return DEFAULT_INHERIT;
- else return SVG_ERROR;
-
- case AT_TARGET: // string
- return TEXT_NOT_SHORT;
-
- case AT_TEXTANCHOR: // start | middle | end | inherit
- if (aValue.equals("start")) return TEXT_ANCHOR_START;
- else if (aValue.equals("middle")) return TEXT_ANCHOR_MIDDLE;
- else if (aValue.equals("end")) return TEXT_ANCHOR_END;
- else if (aValue.equals("inherit")) return DEFAULT_INHERIT;
- else return SVG_ERROR;
-
- case AT_VISIBILITY: // visible | hidden | inherit
- if (aValue.equals("visible")) return VISIBILITY_VISIBLE;
- else if (aValue.equals("hidden")) return VISIBILITY_OTHER;
- else if (aValue.equals("inherit")) return DEFAULT_INHERIT;
- else return SVG_ERROR;
-
- case AT_XLINKHREF: // URI aValue
- return TEXT_NOT_SHORT;
-
- case AT_ZOOMANDPAN: // disable | magnify
- if (aValue.equals("magnify")) return ZPN_MAGNIFY;
- else if (aValue.equals("disable")) return ZPN_DISABLE;
- else return SVG_ERROR;
-
- default:
- return SVG_ERROR;
- }
- }
-
- /**
- * Parse attribute
- * @param aValueId
- * @return Value's name
- */
- static final String parseAttributeValueName(short aAttributeTypeId, short aValueId)
- {
- if (aValueId == 0)
- {
- return "";
- }
- if (aAttributeTypeId == AT_FONTWEIGHT && aValueId == FONT_WEIGHT_LIGHTER)
- {
- return "300";
- }
- else if (aAttributeTypeId == AT_FONTWEIGHT && aValueId == FONT_NORMAL)
- {
- return "400";
- }
- else if (aAttributeTypeId == AT_FONTWEIGHT && aValueId == FONT_WEIGHT_BOLD)
- {
- return "700";
- }
- else if (aAttributeTypeId == AT_FONTWEIGHT && aValueId == FONT_WEIGHT_BOLDER)
- {
- return "800";
- }
- else
- {
- return parseAttributeValueName(aValueId);
- }
- }
-
- /**
- * Converts a short constant to the string representation of a
- * SVGT 1.1 attribute value literal.
- * This method covers all of SVGT 1.1 and not just JSR-226.
- * @param aValueId
- * @return Value's name
- */
- static final String parseAttributeValueName(short aValueId)
- {
-
- switch (aValueId)
- {
- case TEXT_NOT_SHORT:
- return "#text";
-
- case DEFAULT_INHERIT:
- case PAINT_INHERIT:
- return "inherit";
-
- case DISPLAY_NONE:
- case PAINT_NONE:
- return "none";
-
- case DISPLAY_OTHER:
- return "inline";
-
- case PAINT_CURRENT:
- return "currentColor";
-
- case FILL_RULE_NONZERO:
- return "nonzero";
-
- case FILL_RULE_EVENODD:
- return "evenodd";
-
- case FONT_NORMAL:
- return "normal";
-
- case FONT_STYLE_ITALIC:
- return "italic";
-
- case FONT_STYLE_OBLIQUE:
- return "oblique";
-
- case FONT_WEIGHT_BOLD:
- return "bold";
-
- case FONT_WEIGHT_BOLDER:
- return "bolder";
-
- case FONT_WEIGHT_LIGHTER:
- return "lighter";
-
- case FONT_WEIGHT_100:
- return "100";
-
- case FONT_WEIGHT_200:
- return "200";
-
- case FONT_WEIGHT_300:
- return "300";
-
- case FONT_WEIGHT_400:
- return "400";
-
- case FONT_WEIGHT_500:
- return "500";
-
- case FONT_WEIGHT_600:
- return "600";
-
- case FONT_WEIGHT_700:
- return "700";
-
- case FONT_WEIGHT_800:
- return "800";
-
- case FONT_WEIGHT_900:
- return "900";
-
- case STROKE_LINECAP_BUTT:
- return "butt";
-
- case STROKE_LINECAP_ROUND:
- case STROKE_LINEJOIN_ROUND:
- return "round";
-
- case STROKE_LINECAP_SQUARE:
- return "square";
-
- case STROKE_LINEJOIN_MITER:
- return "miter";
-
- case STROKE_LINEJOIN_BEVEL:
- return "bevel";
-
- case TEXT_ANCHOR_START:
- return "start";
-
- case TEXT_ANCHOR_MIDDLE:
- return "middle";
-
- case TEXT_ANCHOR_END:
- return "end";
-
- case VISIBILITY_VISIBLE:
- return "visible";
-
- case VISIBILITY_OTHER:
- return "hidden";
-
- case ZPN_MAGNIFY:
- return "magnify";
-
- case ZPN_DISABLE:
- return "disable";
-
- default:
- return "";
- }
- }
-
- /*
- * Parses path command
- * @param aPathCommandIndex
- * @return path command
- */
- static short parsePathCommand(short aPathCommandIndex)
- {
- short command = SVG_ERROR;
- switch (aPathCommandIndex)
- {
- case PATH_COMMAND_m:
- case PATH_COMMAND_M:
- command = SVGPath.MOVE_TO;
- break;
- case PATH_COMMAND_Z:
- command = SVGPath.CLOSE;
- break;
- case PATH_COMMAND_h:
- case PATH_COMMAND_v:
- case PATH_COMMAND_l:
- case PATH_COMMAND_H:
- case PATH_COMMAND_V:
- case PATH_COMMAND_L:
- command = SVGPath.LINE_TO;
- break;
- case PATH_COMMAND_s:
- case PATH_COMMAND_c:
- case PATH_COMMAND_S:
- case PATH_COMMAND_C:
- command = SVGPath.CURVE_TO;
- break;
- case PATH_COMMAND_t:
- case PATH_COMMAND_q:
- case PATH_COMMAND_T:
- case PATH_COMMAND_Q:
- command = SVGPath.QUAD_TO;
- break;
- default:
- command = SVG_ERROR;
- break;
- }
- return command;
- }
-}
-
--- a/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/M2GSVGElement.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1477 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-package com.nokia.microedition.m2g;
-
-import org.w3c.dom.*;
-import org.w3c.dom.svg.*;
-import org.w3c.dom.events.*;
-//import com.nokia.mj.impl.rt.legacy.ToolkitInvoker;
-import java.io.IOException;
-import org.eclipse.swt.widgets.*;
-//import org.eclipse.swt.widgets.Display;
-import com.nokia.mj.impl.utils.Logger;
-
-public class M2GSVGElement extends M2GObject implements SVGElement
-{
- //--------------------------------------------------
- // STATIC CONSTANTS
- //--------------------------------------------------
- // Error constants
- static final String TYPE_IS_NULL_ESTR =
- "The type is null.";
- static final String LISTENER_IS_NULL_ESTR =
- "The listener is null.";
- static final String CAPTURE_NOT_SUPPORTED_ESTR =
- "The capture phase is not supported in SVG Tiny.";
- //static final String ESWT_PACKAGE =
- // "org.eclipse.swt.widgets.Display" ;
-
- /* Optimization: static finals changed to local variables
- static final String TRAIT_IS_NULL_ESTR =
- "The trait is null.";
- static final String TRAIT_NOT_SUPPORTED_ON_ELEM_ESTR =
- "The trait is not supported on this element.";
- static final String TRAIT_NOT_SUPPORTED_IN_NS_ESTR =
- "The trait is not supported in this namespace.";
- static final String GET_FLOAT_MISMATCH_ESTR =
- "Trait's computed value cannot be converted to a float.";
- static final String SET_FLOAT_MISMATCH_ESTR =
- "Trait's value cannot be specified as a float.";
- static final String GET_MATRIX_MISMATCH_ESTR =
- "Trait's computed value cannot be converted to a SVGMatrix.";
- static final String SET_MATRIX_MISMATCH_ESTR =
- "Trait's value cannot be specified as a SVGMatrix.";
- static final String GET_PATH_MISMATCH_ESTR =
- "Trait's computed value cannot be converted to a SVGPath.";
- static final String SET_PATH_MISMATCH_ESTR =
- "Trait's value cannot be specified as a SVGPath.";
- static final String GET_RECT_MISMATCH_ESTR =
- "Trait's computed value cannot be converted to a SVGRect.";
- static final String SET_RECT_MISMATCH_ESTR =
- "Trait's value cannot be specified as a SVGRect.";
- static final String GET_RGB_MISMATCH_ESTR =
- "Trait's computed value cannot be converted to a SVGRGBColor.";
- static final String SET_RGB_MISMATCH_ESTR =
- "Trait's value cannot be specified as a SVGRGBColor.";
- static final String NS_NOT_SUPPORTED_ESTR =
- "The namespace is not supported.";
- static final String GET_TRAIT_NS_STRING_MISMATCH_ESTR =
- "Trait's computed value cannot be converted to a String.";
- static final String SET_TRAIT_NS_STRING_MISMATCH_ESTR =
- "Trait's value cannot be specified as a String.";
- static final String ID_IS_NULL_ESTR =
- "The id is null.";
- static final String EXISTING_ELEM_ID_CHANGE_ESTR =
- "Existing element id cannot be changed.";
- static final String ELEM_ID_EXIST_IN_DOCUMENT_ESTR =
- "Element id already exists in the document.";
- static final String INVALID_INPUT_VALUE_ESTR =
- "The input value is an invalid value for the given trait.";
- static final String VALUE_IS_NULL_ESTR =
- "Value cannot be set to null.";
- static final String SET_READONLY_MISMATCH_ESTR =
- "Attempt to change readonly trait.";
- static final String INVALID_VALUE_ESTR =
- "The value is invalid.";
- static final String INVALID_USE_ELEMENT_ESTR =
- "The <use> element is hooked into the document tree and the the value of xlink:href is set invalid.";
- static final String CANNOT_REMOVE_NODE_ESTR =
- "Cannot remove this type of node.";
- static final String CANNOT_REMOVE_NOT_CHILD_ESTR =
- "Not a child of this node.";
- static final String CANNOT_REMOVE_NON_NULL_ID_ESTR =
- "The element being removed or one of its decendants have non-null id.";
- static final String INSERT_NODE_OF_THAT_TYPE_ESTR =
- "Cannot insert node of that type.";
- static final String APPEND_DOCUMENT_ESTR =
- "Cannot append Document elements.";
- static final String DOCUMENT_HIERARCHY_ESTR =
- "Hierarchy request error in Document.";
- static final String CHILD_IS_WRONG_TYPE_ESTR =
- "Child is wrong type (Document).";
- static final String CHILD_BELONG_TO_DIFFERENT_DOCUMENT_ESTR =
- "Child belongs to different document.";
- static final String CHILD_NOT_FOUND_ESTR =
- "The child to insert before doesn't exist in this current node.";
- static final String INVALID_ELEMENT_ID_VALUE =
- "Invalid element id value.";
- */
-
- //--------------------------------------------------
- // VARIABLES
- //--------------------------------------------------
- protected M2GDocument iDocument;
- protected short iElementTypeId;
-
- //--------------------------------------------------
- // METHODS
- //--------------------------------------------------
- /**
- * Constructor
- * @param aHandle is native element handle
- * @param aDocument is a reference to a document that owns this element.
- */
- M2GSVGElement(int aElementHandle, M2GDocument aDocument)
- {
- super(aElementHandle);
- iDocument = aDocument;
- doConstruct();
- }
-
-
- /**
- * @see org.w3c.dom.events.EventTarget#addEventListener()
- */
- public void addEventListener(String type, EventListener listener, boolean useCapture)
- {
- if (type == null || type.equals(""))
- {
- throw new NullPointerException(TYPE_IS_NULL_ESTR);
- }
- if (listener == null)
- {
- throw new NullPointerException(LISTENER_IS_NULL_ESTR);
- }
- if (useCapture == true)
- {
- throw new DOMException(
- DOMException.NOT_SUPPORTED_ERR,
- CAPTURE_NOT_SUPPORTED_ESTR);
- }
- iDocument.register(this, type, listener);
- }
-
- /**
- * @see org.w3c.dom.Node#appendChild()
- */
- public Node appendChild(Node newChild)
- {
- // If refChild is null, newChild is inserted at the end of the list
- return insertBefore(newChild, null); // will inform about DOM changes
- }
-
- /**
- * Checks attribute validity
- * @param aAttributeTypeName
- * @return attribute's type id
- * @throws DOMException
- */
- protected short check(String aAttributeTypeName) throws DOMException
- {
- short attributeTypeId = M2GSVGConstants.AT_UNDEFINED;
- if (aAttributeTypeName == null || aAttributeTypeName.equals(""))
- {
- Logger.ELOG(Logger.EJavaUI,
- "check() exception: " + /*SF*/"The trait is null."/*SF*/);
- throw new DOMException(
- DOMException.NOT_SUPPORTED_ERR,
- /*SF*/"The trait is null."/*SF*/);
- }
- // Converts attribute's name
- attributeTypeId = M2GSVGConstants.parseAttributeTypeId(aAttributeTypeName);
- // Checks that element has this attribute
- if (!M2GSVGConstants.checkElementAttribute(attributeTypeId, iElementTypeId))
- {
- Logger.ELOG(Logger.EJavaUI,
- "check() exception: " + /*SF*/"The trait is not supported on this element."/*SF*/);
- throw new DOMException(
- DOMException.NOT_SUPPORTED_ERR,
- /*SF*/"The trait is not supported on this element."/*SF*/);
- }
- return attributeTypeId;
- }
-
- /**
- * @see com.nokia.microedition.m2g.M2GObject#doCheckValidity()
- */
- public boolean doCheckValidity()
- {
- try
- {
- if (super.doCheckValidity() &&
- (iDocument != null) &&
- (iElementTypeId != M2GSVGConstants.EL_UNDEFINED))
- {
- return true;
- }
- }
- catch (IOException e)
- {
- }
- return false;
- }
-
- /**
- * @see com.nokia.microedition.m2g.M2GObject#doCleanup()
- */
- protected void doCleanup()
- {
- iDocument = null;
- iElementTypeId = M2GSVGConstants.EL_UNDEFINED;
- resetHandles();
- }
-
- /**
- * @see com.nokia.microedition.m2g.M2GObject#doConstruct()
- */
- public void doConstruct()
- {
- // No need to register for finalization
- // super.doConstruct();
- iElementTypeId = _getElementTypeId(
- getNativeSVGProxyHandle(), getHandle());
- }
-
- /**
- * Returns a document
- */
- public M2GDocument getDocument()
- {
- return iDocument;
- }
-
- /*
- * Retuns element's type id
- * @return element's type id
- */
- public short getElementTypeId()
- {
- return iElementTypeId;
- }
-
- /**
- * @see org.w3c.dom.svg.SVGElement#getFirstElementChild()
- */
- public Element getFirstElementChild() throws DOMException
- {
- // Get child element's handle
- int childHandle = _getFirstElementChild(
- getNativeSVGProxyHandle(), getHandle());
- if (M2GObject.checkHandle(childHandle))
- {
- return (Element)M2GSVGElement.buildElement(childHandle, iDocument);
- }
- return null;
- }
-
- /**
- * @see org.w3c.dom.svg.SVGElement#getFloatTrait()
- */
- public float getFloatTrait(String name) throws DOMException
- {
- // Optimization: if(!getDocument().getConnectionPolicy().getAccessRight())
- if (!iDocument.iConnectionRight)
- {
- Logger.ELOG(Logger.EJavaUI, "getFloatTrait() - access rights failure");
- throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
- }
- short attributeTypeId = check(name);
- if (!M2GSVGConstants.isGetFloatTraitAllowed(attributeTypeId))
- {
- throw new DOMException(
- DOMException.TYPE_MISMATCH_ERR,
- /*SF*/"Trait's computed value cannot be converted to a float."/*SF*/);
- }
- return _getFloatTrait(
- getNativeSVGProxyHandle(), getHandle(), attributeTypeId);
- }
-
- /**
- * @see org.w3c.dom.svg.SVGElement#getId()
- */
- public String getId()
- {
- return _getStringTrait(
- getNativeSVGProxyHandle(), getHandle(), M2GSVGConstants.AT_ID);
- }
-
- /**
- * @see org.w3c.dom.Node#getLocalName()
- */
- public String getLocalName()
- {
- // Optimization: if(!getDocument().getConnectionPolicy().getAccessRight())
- if (!iDocument.iConnectionRight)
- {
- Logger.ELOG(Logger.EJavaUI,
- "getLocalName() - access rights failure");
- throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
- }
- return M2GSVGConstants.parseElementTypeName(iElementTypeId);
- }
-
- /**
- * @see org.w3c.dom.svg.SVGElement#getMatrixTrait()
- */
- public SVGMatrix getMatrixTrait(String name)
- {
- // Optimization: if(!getDocument().getConnectionPolicy().getAccessRight())
- if (!iDocument.iConnectionRight)
- {
- Logger.ELOG(Logger.EJavaUI,
- "getMatrixTrait() - access rights failure");
- throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
- }
- short attributeTypeId = check(name);
- if (!M2GSVGConstants.isGetMatrixTraitAllowed(attributeTypeId))
- {
- throw new DOMException(
- DOMException.TYPE_MISMATCH_ERR,
- /*SF*/"Trait's computed value cannot be converted to a SVGMatrix."/*SF*/);
- }
- M2GSVGMatrix matrix = new M2GSVGMatrix();
- // If an error is occurred, then no values are put in the
- // matrix array by the native method
- _getMatrixTrait(
- getNativeSVGProxyHandle(),
- getHandle(),
- attributeTypeId,
- matrix.getComponents());
- return matrix;
- }
-
- /**
- * @see org.w3c.dom.Node#getNamespaceURI()
- */
- public String getNamespaceURI()
- {
- // Optimization: if(!getDocument().getConnectionPolicy().getAccessRight())
- if (!iDocument.iConnectionRight)
- {
- Logger.ELOG(Logger.EJavaUI,
- "getNamespaceURI() - access rights failure");
- throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
- }
- return M2GSVGConstants.SVG_NAMESPACE_URI;
- /*
- return _getStringTrait(
- getNativeSVGProxyHandle(),
- getHandle(),
- id);
- */
- }
-
- /**
- * @see org.w3c.dom.svg.SVGElement#getNextElementSibling()
- */
- public Element getNextElementSibling()
- {
- int elementHandle = _getNextElementSibling(
- getNativeSVGProxyHandle(), getHandle());
- if (M2GObject.checkHandle(elementHandle))
- {
- return M2GSVGElement.buildElement(elementHandle, iDocument);
- }
- return null;
- }
-
- /**
- * @see org.w3c.dom.svg.SVGElement#getParentNode()
- */
- public Node getParentNode()
- {
- // Optimization: if(!getDocument().getConnectionPolicy().getAccessRight())
- if (!iDocument.iConnectionRight)
- {
- Logger.ELOG(Logger.EJavaUI,
- "getParentNode() - access rights failure");
- throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
- }
- int parentHandle = _getParent(
- getNativeSVGProxyHandle(), getHandle());
- if (M2GObject.checkHandle(parentHandle))
- {
- return M2GSVGElement.buildElement(parentHandle, iDocument);
- }
- return null;
- }
-
- /**
- * @see org.w3c.dom.svg.SVGElement#getPathTrait()
- */
- public SVGPath getPathTrait(String name)
- {
- // Optimization: if(!getDocument().getConnectionPolicy().getAccessRight())
- if (!iDocument.iConnectionRight)
- {
- Logger.ELOG(Logger.EJavaUI,
- "getPathTrait() - access rights failure");
- throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
- }
- short attributeTypeId = check(name);
- if (!M2GSVGConstants.isGetPathTraitAllowed(attributeTypeId))
- {
- throw new DOMException(
- DOMException.TYPE_MISMATCH_ERR,
- /*SF*/"Trait's computed value cannot be converted to a SVGPath."/*SF*/);
- }
- int pathHandle = _getPathTrait(
- getNativeSVGProxyHandle(),
- getHandle(),
- attributeTypeId);
- if (pathHandle != 0)
- {
- // Path doesn't own the native object
- return new M2GSVGPath(pathHandle);
- }
- else
- {
- return null;
- }
- }
-
- /**
- * @see org.w3c.dom.svg.SVGElement#getRectTrait()
- */
- public SVGRect getRectTrait(String name)
- {
- // Optimization: if(!getDocument().getConnectionPolicy().getAccessRight())
- if (!iDocument.iConnectionRight)
- {
- Logger.ELOG(Logger.EJavaUI,
- "getRectTrait() - access rights failure");
- throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
- }
- short attributeTypeId = check(name);
- if (!M2GSVGConstants.isGetRectTraitAllowed(attributeTypeId))
- {
- throw new DOMException(
- DOMException.TYPE_MISMATCH_ERR,
- /*SF*/"Trait's computed value cannot be converted to a SVGRect."/*SF*/);
- }
- M2GSVGRect rect = new M2GSVGRect();
- if (_getRectTrait(
- getNativeSVGProxyHandle(),
- getHandle(),
- attributeTypeId,
- rect.getComponents()) == -1)
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "getRectTrait() - returns null!!");
- return null;
- }
- else
- {
- return rect;
- }
- }
-
- /**
- * @see org.w3c.dom.svg.SVGElement#getRGBColorTrait()
- */
- public SVGRGBColor getRGBColorTrait(String name)
- {
- // Optimization: if(!getDocument().getConnectionPolicy().getAccessRight())
- if (!iDocument.iConnectionRight)
- {
- Logger.ELOG(Logger.EJavaUI,
- "getRGBColorTrait() - access rights failure");
- throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
- }
-
- short attributeTypeId = check(name);
- if (!M2GSVGConstants.isGetRgbColorTraitAllowed(attributeTypeId))
- {
- throw new DOMException(
- DOMException.TYPE_MISMATCH_ERR,
- /*SF*/"Trait's computed value cannot be converted to a SVGRGBColor."/*SF*/);
- }
- M2GSVGRGBColor rgb = new M2GSVGRGBColor(0, 0, 0);
- int result = _getColorTrait(
- getNativeSVGProxyHandle(),
- getHandle(),
- attributeTypeId,
- rgb.getComponents());
- if (result == -1)
- {
- if ((attributeTypeId == M2GSVGConstants.AT_FILL) ||
- (attributeTypeId == M2GSVGConstants.AT_COLOR))
- {
- return new M2GSVGRGBColor(0, 0, 0);
- }
- else
- {
- return null;
- }
- }
- else if (result == 0)
- {
- return null;
- }
- return rgb;
- }
-
- /**
- * Get trait
- * @see org.w3c.dom.svg.SVGElement#getTrait()
- */
- public String getTrait(String name)
- {
- return getTraitNS(null, name);
- }
-
- /**
- * Get trait
- * @see org.w3c.dom.svg.SVGElement#getTraitNS()
- */
- public String getTraitNS(String namespaceURI, String name)
- {
- // Optimization: if(!getDocument().getConnectionPolicy().getAccessRight())
- if (!iDocument.iConnectionRight)
- {
- Logger.ELOG(Logger.EJavaUI,
- "getTraitNS() - access rights failure");
- throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
- }
-
- // Checks name validity
- short id = check(name);
- String value = null;
-
- // SVG traits are in the so-called element's 'per-element type partitions namespaces'
- // namespace must be always null
- // except for HREF traits which are from XLINK namespace?
-
- // XLINK_NAMESPACE
- if (namespaceURI != null &&
- namespaceURI.equals(M2GSVGConstants.XLINK_NAMESPACE_URI))
- {
- if (!M2GSVGConstants.isGetTraitNSAllowed(id))
- {
- Logger.ELOG(Logger.EJavaUI, "getTraitNS() XLINK eception: " +
- "Trait's computed value cannot be converted to a String.");
- throw new DOMException(
- DOMException.TYPE_MISMATCH_ERR,
- "Trait's computed value cannot be converted to a String.");
- }
-
- value = _getStringTrait(
- getNativeSVGProxyHandle(),
- getHandle(),
- id);
-
- if (value == null)
- {
- value = "";
- }
-
- return value;
- }
-
- // Checks namespace validity: namespace must be null
- if (namespaceURI != null)
- {
- Logger.ELOG(Logger.EJavaUI,
- "getTraitNS() - namespace IS NOT xlink but something else.");
- Logger.ELOG(Logger.EJavaUI,
- "getTraitNS() exception: " + /*SF*/"The namespace is not supported."/*SF*/);
-
- throw new DOMException(
- DOMException.NOT_SUPPORTED_ERR,
- "The namespace is not supported.");
- }
-
- // Checks that attribute is obtaineable as a string
- if (!M2GSVGConstants.isGetTraitNSStringAllowed(id))
- {
- Logger.ELOG(Logger.EJavaUI, "getTraitNS() exception: " +
- "Trait's computed value cannot be converted to a String.");
-
- throw new DOMException(
- DOMException.TYPE_MISMATCH_ERR,
- "Trait's computed value cannot be converted to a String.");
- }
-
- if (id == M2GSVGConstants.AT_XLINKHREF)
- {
- Logger.ELOG(Logger.EJavaUI, "getTraitNS() exception: "
- + "The trait is not supported in this namespace.");
-
- throw new DOMException(
- DOMException.NOT_SUPPORTED_ERR,
- "The trait is not supported in this namespace.");
- }
-
- // Checks if attribute is in string format
- if ((id == M2GSVGConstants.AT_STRING) ||
- (id == M2GSVGConstants.AT_VERSION) ||
- (id == M2GSVGConstants.AT_BASEPROFILE) ||
- (id == M2GSVGConstants.AT_TARGET) ||
- (id == M2GSVGConstants.AT_FONTFAMILY))
- {
- value = _getStringTrait(
- getNativeSVGProxyHandle(),
- getHandle(),
- id);
- }
- // Reads enum attribute
- else
- {
- short valueId = _getEnumTrait(
- getNativeSVGProxyHandle(),
- getHandle(),
- id);
-
- // Convert value id to string
- value = M2GSVGConstants.parseAttributeValueName(id, valueId);
- }
-
- if (value == null)
- {
- value = "";
- }
- return value;
- }
-
- /*
- * Get element used from this element
- * @return Element.
- */
- public SVGElement getUsedFromElement()
- {
- int elementHandle = _getUsedFromElement(
- getNativeSVGProxyHandle(),
- getHandle());
- if (M2GObject.checkHandle(elementHandle))
- {
- return M2GSVGElement.buildElement(elementHandle, iDocument);
- }
- return null;
- }
-
-
- /**
- * @see org.w3c.dom.Node#insertBefore
- */
- public Node insertBefore(Node newChild, Node refChild)
- {
- // Optimization: if(!getDocument().getConnectionPolicy().getAccessRight())
- if (!iDocument.iConnectionRight)
- {
- Logger.ELOG(Logger.EJavaUI,
- "insertBefore() - access rights failure");
- throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
- }
-
- if (newChild == null)
- {
- Logger.ELOG(Logger.EJavaUI,
- "insertBefore() exception - new child is null");
- throw new NullPointerException();
- }
- if (newChild instanceof M2GDocument)
- {
- Logger.ELOG(Logger.EJavaUI,
- "insertBefore() exception - child is document");
- throw new DOMException(
- DOMException.HIERARCHY_REQUEST_ERR,
- /*SF*/"Child is wrong type (Document)."/*SF*/);
- }
-
- if (!M2GSVGConstants.isAllowedToInsertElement(((M2GSVGElement)newChild).iElementTypeId))
- {
- Logger.ELOG(Logger.EJavaUI,
- "insertBefore() exception - cannot insert this node type");
- throw new DOMException(
- DOMException.NOT_SUPPORTED_ERR,
- /*SF*/"Cannot insert node of that type."/*SF*/);
- }
-
- if (!M2GSVGConstants.checkElementAsChild(
- iElementTypeId, ((M2GSVGElement)newChild).iElementTypeId))
- {
- Logger.ELOG(Logger.EJavaUI,
- "insertBefore() exception - invalid parent-child relation");
- throw new DOMException(
- DOMException.HIERARCHY_REQUEST_ERR,
- /*SF*/"Cannot insert node of that type."/*SF*/);
- }
- // Ensure that the new child candidate wouldn't be an ancestor of this element
- if (IsAncestor(newChild, this))
- {
- Logger.ELOG(Logger.EJavaUI,
- "insertBefore() exception - is ancestor");
- throw new DOMException(
- DOMException.HIERARCHY_REQUEST_ERR,
- /*SF*/"Hierarchy request error in Document."/*SF*/);
- }
- // Check that the child and this element belong to the same Document
- if (((M2GSVGElement)newChild).getDocument().getHandle() != iDocument.getHandle())
- {
- Logger.ELOG(Logger.EJavaUI,
- "insertBefore() exception - document is not the same");
- throw new DOMException(
- DOMException.WRONG_DOCUMENT_ERR,
- /*SF*/"Child belongs to different document."/*SF*/);
- }
- if ((refChild != null) &&
- (((M2GSVGElement)refChild.getParentNode()).getHandle() != getHandle()))
- {
- Logger.ELOG(Logger.EJavaUI,
- "insertBefore() exception - ref child is not found");
- throw new DOMException(
- DOMException.NOT_FOUND_ERR,
- /*SF*/"The child to insert before doesn't exist in this current node."/*SF*/);
- }
- // check that if <use> then xlink:href is an existing element id
- if (((M2GSVGElement)newChild).iElementTypeId == M2GSVGConstants.EL_USE)
- {
- String value = ((M2GSVGElement)newChild).getTraitNS(
- M2GSVGConstants.XLINK_NAMESPACE_URI, "href");
- if (value.length() != 0)
- {
- if (!value.startsWith("#") ||
- ((M2GSVGElement)newChild).iDocument.getElementById(value.substring(1)) == null)
- {
- Logger.ELOG(Logger.EJavaUI,
- "insertBefore() exception - \"href\" trait value="
- + value + " is invalid");
- throw new DOMException(
- DOMException.INVALID_STATE_ERR,
- /*SF*/"Invalid element id value."/*SF*/);
- }
- }
- }
- if (refChild == null)
- {
- _appendChild(
- getNativeSVGProxyHandle(),
- getHandle(),
- ((M2GSVGElement)newChild).getHandle());
- }
- else
- {
- _insertBefore(
- getNativeSVGProxyHandle(),
- getHandle(),
- ((M2GSVGElement)newChild).getHandle(),
- ((M2GSVGElement) refChild).getHandle());
- }
- String href = _getStringTrait(
- getNativeSVGProxyHandle(),
- ((M2GSVGElement)newChild).getHandle(),
- M2GSVGConstants.AT_XLINKHREF);
- // Need to call resource handler if element is elementindom, image,
- // and if it has an href attribute
- if ((href != null) &&
- (((M2GSVGElement)newChild).iElementTypeId == M2GSVGConstants.EL_IMAGE) &&
- iDocument.isElementInDOM(((M2GSVGElement)newChild).getHandle()))
- {
- // Call resource handler here
- iDocument.invokeResourceHandler(href);
- }
-
- // inform observer about changes in DOM only if element is in DOM
- iDocument.notifyDOMChangeObserver(iNativeHandle);
-
- return newChild;
- }
-
- /*
- * Check if used
- * @return True if used.
- */
- public boolean isUsed()
- {
- return (_isUsed(
- getNativeSVGProxyHandle(),
- getHandle()) > 0 ? true : false);
- }
-
- /**
- * @see org.w3c.dom.events.EventTarget#removeEventListener()
- */
- public void removeEventListener(String type, EventListener listener, boolean useCapture)
- {
- if (type == null || type.equals("") || listener == null)
- {
- throw new NullPointerException();
- }
- if (useCapture == true)
- {
- throw new DOMException(
- DOMException.NOT_SUPPORTED_ERR,
- CAPTURE_NOT_SUPPORTED_ESTR);
- }
- iDocument.unregister(this, type, listener);
- }
-
- /**
- * @see org.w3c.dom.svg.SVGElement#setId()
- */
- public void setId(String id) throws DOMException
- {
- // Optimization: if(!getDocument().getConnectionPolicy().getAccessRight())
- if (!iDocument.iConnectionRight)
- {
- Logger.ELOG(Logger.EJavaUI,
- "setId() - access rights failure");
- throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
- }
- if (id == null)
- {
- throw new NullPointerException(/*SF*/"The id is null."/*SF*/);
- }
- if (getId() != null)
- {
- throw new DOMException(
- DOMException.NO_MODIFICATION_ALLOWED_ERR,
- /*SF*/"Existing element id cannot be changed."/*SF*/);
- }
- if (iDocument.containsElement(id))
- {
- throw new DOMException(
- DOMException.INVALID_ACCESS_ERR,
- /*SF*/"Element id already exists in the document."/*SF*/);
- }
- else
- {
- _setStringTrait(
- getNativeSVGProxyHandle(),
- getHandle(), M2GSVGConstants.AT_ID, id);
- }
- }
-
- /**
- * @see org.w3c.dom.svg.SVGElement#setFloatTrait()
- */
- public void setFloatTrait(String name, float value)
- {
- // Optimization: if(!getDocument().getConnectionPolicy().getAccessRight())
- if (!iDocument.iConnectionRight)
- {
- Logger.ELOG(Logger.EJavaUI,
- "setFloatTrait() - access rights failure");
- throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
- }
-
- short id = check(name);
- if (!M2GSVGConstants.isSetFloatTraitAllowed(id))
- {
- Logger.ELOG(Logger.EJavaUI,
- "setFloatTrait() exception - set float (id=" + id + ") not allowed");
- throw new DOMException(
- DOMException.TYPE_MISMATCH_ERR,
- /*SF*/"Trait's value cannot be specified as a float."/*SF*/);
- }
- if ((Float.isNaN(value)) ||
- // value must be >= 1
- (value < 1 && (id == M2GSVGConstants.AT_STROKEMITERLIMIT)) ||
- // value must be >= 0
- (value < 0 && (id == M2GSVGConstants.AT_FONTSIZE ||
- id == M2GSVGConstants.AT_STROKEWIDTH ||
- id == M2GSVGConstants.AT_HEIGHT ||
- id == M2GSVGConstants.AT_WIDTH ||
- id == M2GSVGConstants.AT_RX ||
- id == M2GSVGConstants.AT_RY ||
- id == M2GSVGConstants.AT_R)))
- {
- Logger.ELOG(Logger.EJavaUI,
- "setFloatTrait() exception - invalid value=" + value);
- throw new DOMException(
- DOMException.INVALID_ACCESS_ERR,
- /*SF*/"The input value is an invalid value for the given trait."/*SF*/);
- }
- _setFloatTrait(getNativeSVGProxyHandle(),
- getHandle(), id, value);
-
- // inform observer about changes in DOM only if element is in DOM
- iDocument.notifyDOMChangeObserver(iNativeHandle);
- }
-
- /**
- * @see org.w3c.dom.svg.SVGElement#setMatrixTrait()
- */
- public void setMatrixTrait(String name, SVGMatrix matrix)
- {
- // Optimization: if(!getDocument().getConnectionPolicy().getAccessRight())
- if (!iDocument.iConnectionRight)
- {
- Logger.ELOG(Logger.EJavaUI,
- "setMatrixTrait() - access rights failure");
- throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
- }
- short id = check(name);
- if (!M2GSVGConstants.isSetMatrixTraitAllowed(id))
- {
- throw new DOMException(
- DOMException.TYPE_MISMATCH_ERR,
- /*SF*/"Trait's value cannot be specified as a SVGMatrix."/*SF*/);
- }
- if ((matrix == null) ||
- !(matrix instanceof M2GSVGMatrix))
- {
- throw new DOMException(
- DOMException.INVALID_ACCESS_ERR,
- /*SF*/"The input value is an invalid value for the given trait."/*SF*/);
- }
-
- _setMatrixTrait(getNativeSVGProxyHandle(),
- getHandle(), id,
- ((M2GSVGMatrix)matrix).getComponents());
-
- // inform observer about changes in DOM only if element is in DOM
- iDocument.notifyDOMChangeObserver(iNativeHandle);
- }
-
- /**
- * @see org.w3c.dom.svg.SVGElement#setPathTrait()
- */
- public void setPathTrait(String name, SVGPath path)
- {
- // Optimization: if(!getDocument().getConnectionPolicy().getAccessRight())
- if (!iDocument.iConnectionRight)
- {
- Logger.ELOG(Logger.EJavaUI,
- "setPathTrait() - access rights failure");
- throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
- }
- short id = check(name);
- if (!M2GSVGConstants.isSetPathTraitAllowed(id))
- {
- throw new DOMException(
- DOMException.TYPE_MISMATCH_ERR,
- /*SF*/"Trait's value cannot be specified as a SVGPath."/*SF*/);
- }
- if ((path == null) ||
- !(path instanceof M2GSVGPath) ||
- !((M2GSVGPath)path).doCheckValidity())
- {
- Logger.ELOG(Logger.EJavaUI,
- "setPathTrait() - exception M2GSVGPath not valid");
- throw new DOMException(
- DOMException.INVALID_ACCESS_ERR,
- /*SF*/"The input value is an invalid value for the given trait."/*SF*/);
- }
-
- _setPathTrait( getNativeSVGProxyHandle(),
- getHandle(), id, ((M2GSVGPath)path).getHandle());
-
- // inform observer about changes in DOM only if element is in DOM
- iDocument.notifyDOMChangeObserver(iNativeHandle);
- }
-
-
- /**
- * @see org.w3c.dom.svg.SVGElement#setPathTrait()
- */
- public void setRectTrait(String name, SVGRect rect)
- {
- // Optimization: if(!getDocument().getConnectionPolicy().getAccessRight())
- if (!iDocument.iConnectionRight)
- {
- Logger.ELOG(Logger.EJavaUI,
- "setRectTrait() - access rights failure");
- throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
- }
- short id = check(name);
- if (!M2GSVGConstants.isSetRectTraitAllowed(id))
- {
- throw new DOMException(
- DOMException.TYPE_MISMATCH_ERR,
- /*SF*/"Trait's value cannot be specified as a SVGRect."/*SF*/);
- }
- if ((rect == null) ||
- (rect.getWidth() < 0 || rect.getHeight() < 0))
- {
- throw new DOMException(
- DOMException.INVALID_ACCESS_ERR,
- /*SF*/"The input value is an invalid value for the given trait."/*SF*/);
- }
-
- _setRectTrait(
- getNativeSVGProxyHandle(), getHandle(), id,
- rect.getX(), rect.getY(), rect.getWidth(), rect.getHeight());
-
- // inform observer about changes in DOM only if element is in DOM
- iDocument.notifyDOMChangeObserver(iNativeHandle);
- }
-
- /**
- * @see org.w3c.dom.svg.SVGElement#setRGBColorTrait()
- */
- public void setRGBColorTrait(String name, SVGRGBColor color)
- {
-
- // Optimization: if(!getDocument().getConnectionPolicy().getAccessRight())
- if (!iDocument.iConnectionRight)
- {
- Logger.ELOG(Logger.EJavaUI,
- "setRGBColorTrait() - access rights failure");
- throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
- }
- short id = check(name);
- if (!M2GSVGConstants.isSetRgbColorTraitAllowed(id))
- {
- Logger.ELOG(Logger.EJavaUI,
- "setRGBColorTrait() - exception: " + DOMException.TYPE_MISMATCH_ERR);
- throw new DOMException(
- DOMException.TYPE_MISMATCH_ERR,
- /*SF*/"Trait's value cannot be specified as a SVGRGBColor."/*SF*/);
- }
- if (color == null)
- {
- Logger.ELOG(Logger.EJavaUI,
- "setRGBColorTrait() - exception: " + DOMException.INVALID_ACCESS_ERR);
- throw new DOMException(
- DOMException.INVALID_ACCESS_ERR,
- /*SF*/"The trait is null."/*SF*/);
- }
-
- _setColorTrait(
- getNativeSVGProxyHandle(), getHandle(), id,
- color.getRed(), color.getGreen(), color.getBlue());
-
- // inform observer about changes in DOM only if element is in DOM
- iDocument.notifyDOMChangeObserver(iNativeHandle);
- }
-
- /**
- * @see org.w3c.dom.svg.SVGElement#setTrait()
- */
- public void setTrait(String name, String value)
- {
- setTraitNS(null, name, value);
- }
-
- /**
- * @see org.w3c.dom.svg.SVGElement#setTraitNS()
- */
- public void setTraitNS(String namespaceURI, String name, String value)
- {
- // Optimization: if(!getDocument().getConnectionPolicy().getAccessRight())
- if (!iDocument.iConnectionRight)
- {
- Logger.ELOG(Logger.EJavaUI,
- "setTraitNS() - access rights failure");
- throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
- }
- if (value == null)
- {
- throw new DOMException(
- DOMException.INVALID_ACCESS_ERR,
- /*SF*/"Value cannot be set to null."/*SF*/);
- }
-
- short id = check(name);
-
- // SVG traits are in the so-called element's 'per-element type partitions namespaces'
- // namespace must be always null
- // except for HREF traits which are from XLINK namespace?
-
- if (namespaceURI != null &&
- namespaceURI.equals(M2GSVGConstants.XLINK_NAMESPACE_URI))
- {
- if (!M2GSVGConstants.isGetTraitNSAllowed(id))
- {
- throw new DOMException(
- DOMException.TYPE_MISMATCH_ERR,
- "Trait's value cannot be specified as a String.");
- }
-
- // check that if <use> then xlink:href is an existing element id
- if ((iElementTypeId == M2GSVGConstants.EL_USE) &&
- (iDocument.isElementInDOM(getHandle())))
- {
- if ((value.length() <= 1) ||
- !value.startsWith("#") ||
- (iDocument.getElementById(value.substring(1)) == null))
- {
- Logger.ELOG(Logger.EJavaUI,
- "setTraitNS() - DOMException");
- throw new DOMException(
- DOMException.INVALID_ACCESS_ERR,
- /*SF*/"The <use> element is hooked into the document tree and the the value of xlink:href is set invalid."/*SF*/);
- }
- }
-
- _setStringTrait(
- getNativeSVGProxyHandle(), getHandle(), id, value);
-
- // inform observer about changes in DOM only if element is in DOM
- iDocument.notifyDOMChangeObserver(iNativeHandle);
-
- // Check if element is in DOM and in that case invokes
- // resource handler
- if ((iElementTypeId == M2GSVGConstants.EL_IMAGE) &&
- (id == M2GSVGConstants.AT_XLINKHREF) &&
- (iDocument.isElementInDOM(getHandle())))
- {
- if (!iDocument.containsExternalResourceURI(value))
- {
- iDocument.invokeResourceHandler(value);
- }
- }
-
- return;
- } // namespaceURI != null && namespaceURI.equals(M2GSVGConstants.XLINK_NAMESPACE_URI)
-
- // all traits except HREF must have no namespace
- if (namespaceURI != null)
- {
- throw new DOMException(
- DOMException.NOT_SUPPORTED_ERR,
- "The namespace is not supported.");
- }
-
- if ((id == M2GSVGConstants.AT_VERSION) ||
- (id == M2GSVGConstants.AT_BASEPROFILE))
- {
- throw new DOMException(
- DOMException.NO_MODIFICATION_ALLOWED_ERR,
- /*SF*/"Attempt to change readonly trait."/*SF*/);
- }
-
- if (id == M2GSVGConstants.AT_XLINKHREF)
- {
- throw new DOMException(
- DOMException.NOT_SUPPORTED_ERR,
- /*SF*/"The trait is not supported in this namespace."/*SF*/);
- }
-
- if (!M2GSVGConstants.isSetTraitNSStringAllowed(id))
- {
- throw new DOMException(
- DOMException.TYPE_MISMATCH_ERR,
- /*SF*/"Trait's value cannot be specified as a String."/*SF*/);
- }
-
- short valueId = M2GSVGConstants.parseAttributeValueNameId(id, value);
-
- if (valueId == M2GSVGConstants.SVG_ERROR)
- {
- throw new DOMException(
- DOMException.INVALID_ACCESS_ERR,
- /*SF*/"The value is invalid."/*SF*/);
- }
- else if (valueId == M2GSVGConstants.TEXT_NOT_SHORT)
- {
- _setStringTrait(
- getNativeSVGProxyHandle(), getHandle(), id, value);
- }
- else
- {
- _setEnumTrait(
- getNativeSVGProxyHandle(), getHandle(), id, valueId);
- }
-
- // inform observer about changes in DOM only if element is in DOM
- iDocument.notifyDOMChangeObserver(iNativeHandle);
- }
-
- /**
- * @see org.w3c.dom.Node#removeChild
- */
- public Node removeChild(Node oldChild) throws DOMException
- {
- // Optimization: if(!getDocument().getConnectionPolicy().getAccessRight())
- if (!iDocument.iConnectionRight)
- {
- Logger.ELOG(Logger.EJavaUI,
- "removeChild() - access rights failure");
- throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
- }
- if (oldChild == null)
- {
- throw new NullPointerException();
- }
- if (oldChild instanceof M2GDocument)
- {
- throw new DOMException(
- DOMException.NOT_SUPPORTED_ERR,
- /*SF*/"Cannot remove this type of node."/*SF*/);
- }
-
- M2GSVGElement removableChild = (M2GSVGElement)oldChild;
-
- if (!M2GSVGConstants.isAllowedToRemoveElement(
- removableChild.iElementTypeId))
- {
- throw new DOMException(
- DOMException.NOT_SUPPORTED_ERR,
- /*SF*/"Cannot remove this type of node."/*SF*/);
- }
- M2GSVGElement parent = (M2GSVGElement)removableChild.getParentNode();
- if ((parent == null) ||
- (parent.getHandle() != getHandle()))
- {
- throw new DOMException(
- DOMException.NOT_FOUND_ERR,
- /*SF*/"Not a child of this node."/*SF*/);
- }
- // Check if removable
- int result = _checkRemoveable(
- getNativeSVGProxyHandle(),
- removableChild.getHandle());
- if (result <= 0)
- {
- throw new DOMException(
- DOMException.INVALID_ACCESS_ERR,
- /*SF*/"The element being removed or one of its decendants have non-null id."/*SF*/);
- }
- // The removedChildHandle handle should be same as the removableChild handle
- int removedChildHandle = removedChildHandle = _removeChild(
- getNativeSVGProxyHandle(),
- getHandle(), removableChild.getHandle());
- // Remove the element from the live elements
- removableChild.getDocument().unregisterLiveElement(
- new Integer(removableChild.getHandle()));
-
- iDocument.notifyDOMChangeObserver(getHandle());
-
- return removableChild;
- }
-
- //--------------------------------------------------
- // STATIC METHODS
- //--------------------------------------------------
-
- /**
- * Creates SVGElement instance according to the element type.
- * Possible element types are: SVGElement, SVGLocatableElement,
- * SVGSVGElement, SVGAnimationElement
- */
- public static SVGElement buildElement(int aElementHandle, M2GDocument aDocument)
- {
- // Check native handle
- if (!M2GObject.checkHandle(aElementHandle) || (aDocument == null))
- {
- return null;
- }
-
- // Check if the element already exists
- SVGElement svgElement = aDocument.findLiveElement(new Integer(aElementHandle));
- if (svgElement != null)
- {
- return svgElement;
- }
-
- String typeName = M2GSVGElement.getElementTypeName(aElementHandle, aDocument);
-
- if (M2GSVGConstants.isRootElement(typeName))
- {
- svgElement = M2GSVGSVGElement.buildRootElement(aDocument);
- }
- else if (M2GSVGConstants.isLocatableElement(typeName))
- {
- svgElement = new M2GSVGLocatableElement(aElementHandle, aDocument);
- }
- else if (M2GSVGConstants.isAnimatableElement(typeName))
- {
- svgElement = new M2GSVGAnimationElement(aElementHandle, aDocument);
- }
- else
- {
-
- String id = M2GSVGElement._getStringTrait(
- M2GManager.getInstance().getSVGProxyHandle(),
- aElementHandle,
- M2GSVGConstants.AT_ID );
- if ((id != null) && id.equals("text_use_svg_default_font"))
- {
- return buildElement(
- M2GSVGElement._getNextElementSibling(
- aDocument.getNativeSVGProxyHandle(), aElementHandle),
- aDocument);
- }
- else
- {
- svgElement = new M2GSVGElement(aElementHandle, aDocument);
- }
- }
- aDocument.registerLiveElement(svgElement, new Integer(aElementHandle));
- return svgElement;
- }
-
- /**
- * Helper function for appendChild and insertBefore
- * returns true if "ancestor" is the same node as "child" or
- * if "ancestor" is parent/ancestor of "child" else returns false
- */
- private static final boolean IsAncestor(Node aAncestor, Node aChild) throws DOMException
- {
- boolean result = false;
- if (aAncestor != null && aChild != null)
- {
- if (aChild instanceof M2GDocument)
- {
- throw new DOMException(
- DOMException.HIERARCHY_REQUEST_ERR,
- /*SF*/"Cannot append Document elements."/*SF*/);
- }
- if ((aChild instanceof M2GSVGElement) && (aAncestor instanceof M2GSVGElement))
- {
- // Should check all types or just parent type???
- if (((M2GSVGElement)aAncestor).getHandle() == ((M2GSVGElement)aChild).getHandle())
- {
- result = true;
- }
- else
- {
- result = IsAncestor(aAncestor, aChild.getParentNode());
- }
- }
- }
- return result;
- }
-
-
- /**
- * Helper function for removeChild.
- * @returns false if the node "child" and all its children have non-null ids
- * else returns true
- */
- private static final boolean IsReadOnly(Node aChild)
- {
- if (aChild != null)
- {
- // Should check all types or just parent type???
- if ((aChild instanceof M2GSVGElement) ||
- (aChild instanceof SVGLocatableElement) ||
- (aChild instanceof SVGSVGElement))
- {
- if (M2GSVGConstants.isElementReadOnly(((M2GSVGElement)aChild).getLocalName()))
- {
- return true;
- }
- return IsReadOnly(aChild.getParentNode());
- }
- }
- return false;
- }
-
- /**
- * Get element's type name
- * @param aElementHandle
- * @param aDocument
- * @return element's type name
- */
- public static String getElementTypeName(int aElementHandle, M2GDocument aDocument)
- {
- short elemenTypeId = M2GSVGConstants.EL_UNDEFINED;
- if (aDocument != null)
- {
- elemenTypeId = M2GSVGElement._getElementTypeId(
- aDocument.getNativeSVGProxyHandle(),
- aElementHandle);
- }
- else
- {
- elemenTypeId = M2GSVGElement._getElementTypeId(
- M2GManager.getInstance().getSVGProxyHandle(),
- aElementHandle);
- }
-
- return M2GSVGConstants.parseElementTypeName(elemenTypeId);
- }
-
- //--------------------------------------------------
- // NATIVE METHODS
- //--------------------------------------------------
- private static native void _appendChild(
- int aSvgProxyHandle, int aElementHandle, int aNewChild);
-
- private static native int _checkRemoveable(
- int aSvgProxyHandle, int aElementHandle);
-
- static native int _getBBox(
- int aSvgProxyHandle, int aElementHandle,
- short aAttributeTypeId, float[] aComponents);
-
- private static native int _getColorTrait(
- int aSvgProxyHandle, int aElementHandle,
- short aAttributeTypeId, int[] aColorComponents);
-
- private static native short _getElementTypeId(
- int aSvgProxyHandle, int aElementHandle);
-
- static native short _getEnumTrait(
- int aSvgProxyHandle, int aElementHandle, short aAttributeTypeId);
-
- private static native int _getFirstElementChild(
- int aSvgProxyHandle, int aElementHandle);
-
- private static native float _getFloatTrait(
- int aSvgProxyHandle, int aElementHandle, short aAttributeTypeId);
-
- static native int _getMatrixTrait(
- int aSvgProxyHandle, int aElementHandle,
- short aAttributeTypeId, float[] aComponents);
-
- private static native int _getNextElementSibling(
- int aSvgProxyHandle, int aElementHandle);
-
- private static native int _getParent(
- int aSvgProxyHandle, int aElementHandle);
-
- private static native int _getPathTrait(
- int aSvgProxyHandle, int aElementHandle, short aAttributeTypeId);
-
- static native int _getRectTrait(
- int aSvgProxyHandle, int aElementHandle,
- short aAttributeTypeId, float[] aComponents);
-
- native static int _getRootElement(
- int aSvgProxyHandle, int aDocumentHandle);
-
- static native void _getScreenBBox(
- int aSvgProxyHandle, int aElementHandle, float[] aComponents);
-
- protected static native String _getStringTrait(
- int aSvgProxyHandle, int aElementHandle, short aAttributeTypeId);
-
- private static native int _getUsedFromElement(
- int aSvgProxyHandle, int aElementHandle);
-
- private static native void _insertBefore(
- int aSvgProxyHandle, int aElementHandle,
- int aChildElementHandle, int aReferenceElementHandle);
-
- private static native int _isUsed(
- int aSvgProxyHandle, int aElementHandle);
-
- private static native int _removeChild(
- int aSvgProxyHandle, int aElementHandle, int aChildElementHandle);
-
- private static native void _setColorTrait(
- int aSvgProxyHandle, int aElementHandle, short aAttributeTypeId,
- int aRed, int aGreen, int aBlue);
-
- private static native void _setEnumTrait(
- int aSvgProxyHandle, int aElementHandle, short aAttributeTypeId,
- short aValue);
-
- private static native void _setFloatTrait(
- int aSvgProxyHandle, int aElementHandle, short aAttributeTypeId, float aValue);
-
- static native void _setMatrixTrait(
- int aSvgProxyHandle, int aElementHandle,
- short aAttributeTypeId, float[] aComponents);
-
- private static native void _setPathTrait(
- int aSvgProxyHandle, int aElementHandle, short aAttributeTypeId, int aPathHandle);
-
- private static native void _setRectTrait(
- int aSvgProxyHandle, int aElementHandle, short aAttributeTypeId,
- float aX, float aY, float aWidth, float aHeight);
-
- private static native void _setStringTrait(
- int aSvgProxyHandle, int aElementHandle, short aAttributeTypeId, String aValue);
-
-}
--- a/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/M2GSVGElementWrapper.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,126 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-package com.nokia.microedition.m2g;
-
-import org.w3c.dom.events.*;
-import org.w3c.dom.DOMException;
-import com.nokia.mj.impl.utils.Logger;
-
-public class M2GSVGElementWrapper extends M2GObject implements EventTarget
-{
- //--------------------------------------------------
- // VARIABLES
- //--------------------------------------------------
- private M2GSVGElement iElement;
-
- //--------------------------------------------------
- // METHODS
- //--------------------------------------------------
- /**
- * Constructor
- * @param aElement Element to be wrapped
- */
- M2GSVGElementWrapper(M2GSVGElement aElement)
- {
- super();
- iElement = aElement;
- }
-
- /**
- * Cleanup operations.
- */
- void doCleanup()
- {
- }
-
- /**
- * Construct operations.
- */
- void doConstruct()
- {
- if (iElement != null)
- {
- setHandle(iElement.getHandle());
- }
- }
-
- /**
- * @see org.w3c.dom.events.EventTarget#addEventListener()
- */
- public void addEventListener(String type, EventListener listener, boolean useCapture)
- {
- if (type == null || type.equals(""))
- {
- throw new NullPointerException(M2GSVGElement.TYPE_IS_NULL_ESTR);
- }
- if (listener == null)
- {
- throw new NullPointerException(M2GSVGElement.LISTENER_IS_NULL_ESTR);
- }
- if (useCapture == true)
- {
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR,
- M2GSVGElement.CAPTURE_NOT_SUPPORTED_ESTR);
- }
- try
- {
- iElement.getDocument().register(iElement, type, listener);
- }
- catch (Exception e)
- {
- Logger.ELOG(Logger.EJavaUI, "addEventListener() exception:" + e.toString());
- }
- }
-
- /**
- * Get wrapped target element
- * @return Event target
- */
- public EventTarget getWrappedTarget()
- {
- return iElement;
- }
-
- /**
- * @see org.w3c.dom.events.EventTarget#removeEventListener()
- */
- public void removeEventListener(String type, EventListener listener, boolean useCapture)
- {
- if (type == null || type.equals(""))
- {
- throw new NullPointerException(M2GSVGElement.TYPE_IS_NULL_ESTR);
- }
- if (listener == null)
- {
- throw new NullPointerException(M2GSVGElement.LISTENER_IS_NULL_ESTR);
- }
- if (useCapture == true)
- {
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR,
- M2GSVGElement.CAPTURE_NOT_SUPPORTED_ESTR);
- }
- try
- {
- iElement.getDocument().unregister(iElement, type, listener);
- }
- catch (Exception e)
- {
- Logger.ELOG(Logger.EJavaUI, "removeEventListener() exception:" + e.toString());
- }
- }
-}
--- a/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/M2GSVGImage.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,475 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-package com.nokia.microedition.m2g;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import javax.microedition.m2g.ExternalResourceHandler;
-import javax.microedition.m2g.SVGImage;
-import org.w3c.dom.Document;
-import org.w3c.dom.svg.SVGElement;
-import org.w3c.dom.DOMException;
-import com.nokia.microedition.m2g.connection.*;
-import com.nokia.mj.impl.utils.Logger;
-import com.nokia.mj.impl.utils.StreamUtils;
-
-
-/*
- * Image implementation
- */
-public class M2GSVGImage
- extends SVGImage
-{
- //--------------------------------------------------
- // STATIC CONSTANTS
- //--------------------------------------------------
- /* Optimization: static finals changed to local variables
- private static final String NULL_TYPE_ESTR =
- "The type is null.";
- private static final String ILLEGAL_VALUS_ESTR =
- "The x or y values are negative.";
- private static final String EVENT_TYPE_NOT_SUPPORTED_ESTR =
- "The event type is not supported.";
- private static final String INVALID_ELEMENT_ESTR =
- "Invalid element.";
- public static final String URI_IS_NULL_ESTR =
- "The URI is null.";
- */
-
- //--------------------------------------------------
- // VARIABLES
- //--------------------------------------------------
- M2GDocument iDocument = null;
- private SVGElement iFocusedNode = null;
-
- //--------------------------------------------------
- // METHODS
- //--------------------------------------------------
- /**
- * Constructor
- */
- M2GSVGImage()
- {
- super();
- }
-
- /**
- * @see javax.microedition.m2g.SVGImage#activate()
- */
- public void activate()
- {
- SVGElement node = iFocusedNode;
- while (node != null)
- {
- ((M2GDocument)getDocument()).handleEvent(new M2GEvent(
- M2GSVGConstants.EVENT_ACTIVATE,
- node,
- M2GEvent.EVENT_TARGET));
- node = (SVGElement)node.getParentNode();
- }
- }
-
- /**
- * @see javax.microedition.m2g.SVGImage#dispatchMouseEvent()
- */
- public void dispatchMouseEvent(String type, int x, int y)
- {
- if (type == null || type.equals(""))
- {
- Logger.ELOG(Logger.EJavaUI, "dispatchMouseEvent() NullPointerException");
- throw new NullPointerException(/*SF*/"The type is null."/*SF*/);
- }
- if (x < 0 || y < 0)
- {
- Logger.ELOG(Logger.EJavaUI,
- "dispatchMouseEvent() IllegalArgumentException");
- throw new IllegalArgumentException(/*SF*/"The x or y values are negative."/*SF*/);
- }
- if (!type.equals(M2GSVGConstants.EVENT_CLICK))
- {
- Logger.ELOG(Logger.EJavaUI,
- "dispatchMouseEvent() DOMException - only click event is supported");
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR, /*SF*/"The event type is not supported."/*SF*/);
- }
- int elementHandle = _dispatchMouseEvent(
- iDocument.getNativeSVGProxyHandle(),
- iDocument.getHandle(), x, y);
-
- SVGElement targetElement = M2GSVGElement.buildElement(elementHandle, iDocument);
- SVGElement usedFromElement = null;
- if ((targetElement != null) && ((M2GSVGElement)targetElement).isUsed())
- {
- usedFromElement = ((M2GSVGElement)((M2GSVGElement)targetElement).getUsedFromElement());
- }
- if (targetElement instanceof M2GSVGElement)
- {
- iFocusedNode = targetElement;
- }
- while (targetElement != null)
- {
- // click event
- iDocument.handleEvent(new M2GEvent(
- M2GSVGConstants.EVENT_CLICK, targetElement, M2GEvent.EVENT_TARGET));
- // DOMActivate event
- iDocument.handleEvent(new M2GEvent(
- M2GSVGConstants.EVENT_ACTIVATE, targetElement, M2GEvent.EVENT_TARGET));
- // Gets parent node
- targetElement = (SVGElement)targetElement.getParentNode();
- }
- // The "target element" is only a clone. The "used from element" is the actual element.
- if (usedFromElement != null)
- {
- iDocument.handleEvent(new M2GEvent(
- M2GSVGConstants.EVENT_CLICK, usedFromElement, M2GEvent.WRAPPED_EVENT_TARGET));
- iDocument.handleEvent(new M2GEvent(
- M2GSVGConstants.EVENT_ACTIVATE, usedFromElement, M2GEvent.WRAPPED_EVENT_TARGET));
- }
- }
-
- /**
- * @see javax.microedition.m2g.SVGImage#focusOn()
- */
- public void focusOn(SVGElement element)
- {
- SVGElement tempNode = element;
- // If focusOn is called on the same element, do not focus out.
- boolean callFocusOut =
- (((iFocusedNode != null) && (iFocusedNode == element ? false : true)) || ((iFocusedNode != null) && (element == null)));
- //Checking to see if the element is hooked into the tree.
- if (element != null)
- {
- tempNode = element;
- while (tempNode != null)
- {
- if ((tempNode.getLocalName()).equals(M2GSVGConstants.ROOT_SVG_ELEMENT_NAME))
- {
- // Breaks if tempNode is root svg
- break;
- }
- tempNode = (SVGElement)tempNode.getParentNode();
- }
- // This indicates that the element does not contain a root element,
- // therefore does not belong to the document.
- if (tempNode == null)
- {
- Logger.ELOG(Logger.EJavaUI, "focusOn() - DOMException invalid element");
- throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, /*SF*/"Invalid element."/*SF*/);
- }
- }
- // Focus out from the current focused node and its parents
- if (callFocusOut)
- {
- if (iFocusedNode instanceof M2GSVGElement)
- {
- _focusOut(
- ((M2GSVGElement)iFocusedNode).getNativeSVGProxyHandle(),
- ((M2GSVGElement)iFocusedNode).getDocument().getHandle(),
- ((M2GSVGElement)iFocusedNode).getHandle());
- }
-
- // Focus out the current focused node and its parents
- tempNode = iFocusedNode;
- while (tempNode != null)
- {
- iDocument.handleEvent(new M2GEvent(
- M2GSVGConstants.EVENT_FOCUS_OUT, tempNode, M2GEvent.EVENT_TARGET));
- tempNode = (SVGElement)tempNode.getParentNode();
- }
- }
- //focus in for element and its parents
- if ((element != null) && (element instanceof M2GSVGElement))
- {
- _focusOn(
- ((M2GSVGElement)element).getNativeSVGProxyHandle(),
- ((M2GSVGElement)element).getDocument().getHandle(),
- ((M2GSVGElement)element).getHandle() );
- }
- tempNode = element;
- while (tempNode != null)
- {
- iDocument.handleEvent(new M2GEvent(
- M2GSVGConstants.EVENT_FOCUS_IN, tempNode, M2GEvent.EVENT_TARGET));
- tempNode = (SVGElement)tempNode.getParentNode();
- }
- // Sets the new focus
- iFocusedNode = element;
- }
-
- /**
- * @see javax.microedition.m2g.SVGImage#getDocument()
- */
- public Document getDocument()
- {
- return iDocument;
- }
-
- /**
- * @see javax.microedition.m2g.ScalableImage#getViewportHeight()
- */
- public synchronized int getViewportHeight()
- {
- return iDocument.getViewportHeight();
- }
-
-
- /*
- * @see javax.microedition.m2g.ScalableImage#getViewportWidth()
- */
- public synchronized int getViewportWidth()
- {
- return iDocument.getViewportWidth();
- }
-
- /**
- * @see javax.microedition.m2g.SVGImage#incrementTime()
- */
- public void incrementTime(float seconds)
- {
- ((M2GSVGSVGElement)iDocument.getDocumentElement()).incrementTime(seconds);
- }
-
- /**
- * @see javax.microedition.m2g.ScalableImage#requestCompleted()
- */
- public void requestCompleted(String uri, InputStream resourceData) throws IOException
- {
- if (uri == null)
- {
- Logger.ELOG(Logger.EJavaUI,
- "requestCompleted() throw NullPointerException");
- throw new NullPointerException(/*SF*/"The URI is null."/*SF*/);
- }
-
- if (resourceData != null)
- {
- byte receiveData[] = StreamUtils.readBytesFromStream(resourceData, -1);
- iDocument.requestCompleted(uri, receiveData);
- }
- else
- {
- // Indicates that the requested resource could not be
- // fetched by the ResourceHandler or application,
- // and in this event the SVG engine will not make further attempts
- // to load this resource.
- // Pass the null to the native side so it can delete the image
- iDocument.requestCompleted(uri, null);
- }
- }
-
- /**
- * Set document
- * @param aDocument -
- */
- public void setDocument(M2GDocument aDocument)
- {
- iDocument = aDocument;
- }
-
- /**
- * @see javax.microedition.m2g.ScalableImage#setViewportHeight()
- */
- public synchronized void setViewportHeight(int height)
- {
- iDocument.setViewportHeight(height);
- }
-
- /**
- * @see javax.microedition.m2g.ScalableImage#setViewportWidth()
- */
- public synchronized void setViewportWidth(int width)
- {
- iDocument.setViewportWidth(width);
- }
-
- //--------------------------------------------------
- // STATIC METHODS
- //--------------------------------------------------
- /*
- * @see javax.microedition.m2g.SVGImage#createEmptyImage()
- */
- public static M2GSVGImage buildEmptyImage(ExternalResourceHandler handler)
- {
- try
- {
- return M2GSVGImage.buildImage(
- new ByteArrayInputStream(
- M2GSVGConstants.getInstance().iEmptySvgDocument.getBytes()),
- handler, null, null);
- }
- catch (IOException e)
- {
- Logger.ELOG(Logger.EJavaUI, "M2GSVGImage: buildEmptyImage - IOEception: " + e.toString());
- }
- return null;
- }
-
- /**
- * Build svg image
- * @see javax.microedition.m2g.ScalableImage#createImage()
- * @param stream Plain text stream that contains svg data
- * @param handler External resource handler. If null then default
- * external resource handler is used.
- * @param baseUrl A base url from where a document is downloaded.
- * @param suffixUrl The suffix url according to the DRM opening mode of the SVG file
- * Null if it's not known.
- */
- public static M2GSVGImage buildImage(
- InputStream stream,
- ExternalResourceHandler handler,
- String baseUrl,
- String suffixUrl) throws IOException
- {
- if (stream == null)
- {
- throw new NullPointerException();
- }
- System.out.println("P-M2GSVGImage");
-
- String strData = new String(StreamUtils.readBytesFromStream(stream, -1));
-
- // Default handler is used if the specified handler is null
- if (handler == null)
- {
- handler = M2GConnectionFactory.getExternalResourceHandler(null);
- }
-
- // Creates and setups svg image
- M2GSVGImage image = new M2GSVGImage();
- System.out.println("P-M2GSVGImage call to buildDocument");
- M2GDocument document = M2GDocument.buildDocument(
- image,
- baseUrl,
- suffixUrl,
- strData,
- handler);
- // Checks document validity
- System.out.println("P-M2GSVGImage call to buildDocument Completed Setting documents");
- image.setDocument(document);
- if (handler != null)
- {
- // Gets size of external resources
- int itemCount = _getExternalListSize(
- document.getNativeSVGProxyHandle(),
- document.getHandle());
-
- // Loops through external items
- for (int index = 0; index < itemCount; index++)
- {
- String url = _getExternalListItem(
- document.getNativeSVGProxyHandle(),
- document.getHandle(),
- index);
- // Calls an external implementation of the resource handler
- if ((url != null) && !(url.equals("")))
- {
- document.invokeResourceHandler(url);
- }
- }
- }
-
- // initialise the viewport
- _initViewport(document.getNativeSVGProxyHandle(),
- document.getHandle());
-
- return image;
- }
-
- /**
- * @see javax.microedition.m2g.ScalableImage#createImage()
- */
- public static M2GSVGImage buildImage(
- String url, ExternalResourceHandler handler) throws IOException
- {
- // Checks passed parameters
- if (url == null)
- {
- Logger.ELOG(Logger.EJavaUI,
- "M2GSVGImage: 2 buildImage() - url is null");
- throw new NullPointerException();
- }
- if (url.length() == 0)
- {
- Logger.ELOG(Logger.EJavaUI,
- "M2GSVGImage: 2 buildImage() - url is empty");
- throw new IllegalArgumentException();
- }
- // Default handler is used if the specified handler is null
- if (handler == null)
- {
- handler = M2GConnectionFactory.getExternalResourceHandler(url);
- }
-
- // Open the url and get input stream
- M2GSVGImage image = null;
- M2GConnectionProxy connectionProxy = null;
- try
- {
- connectionProxy = M2GConnectionFactory.create(url);
- image = M2GSVGImage.buildImage(
- connectionProxy.getInputStream(),
- handler,
- connectionProxy.getBaseUrl(),
- connectionProxy.getSuffixUrl());
- // Set connection policy
- if (image != null)
- {
- Document doc = image.getDocument();
- if (doc != null)
- {
- ((M2GDocument)doc).setConnectionPolicy(
- connectionProxy.getConnectionPolicy());
- }
- }
- return image;
- }
- finally
- {
- if (connectionProxy != null)
- {
- connectionProxy.close();
- connectionProxy = null;
- }
- }
- }
-
- //--------------------------------------------------
- // NATIVE METHODS
- //--------------------------------------------------
- private native static int _dispatchMouseEvent(
- int aSvgProxyHandle,int aDocumentHandle,
- int aX, int aY);
-
- private native static void _focusOn(
- int aSvgProxyHandle,int aDocumentHandle,
- int aSvgElementHandle);
-
- private native static void _focusOut(
- int aSvgProxyHandle,int aDocumentHandle,
- int aSvgElementHandle);
-
- native static int _getExternalListSize(
- int aSvgProxyHandle, int aDocumentHandle);
-
- native static String _getExternalListItem(
- int aSvgProxyHandle, int aDocumentHandle,
- int aIndex);
-
- private native static void _initViewport(
- int aSvgProxyHandle, int aDocumentHandle);
-}
--- a/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/M2GSVGLocatableElement.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-package com.nokia.microedition.m2g;
-
-import org.w3c.dom.svg.*;
-
-public class M2GSVGLocatableElement
- extends M2GSVGElement
- implements SVGLocatableElement
-{
- //------------------------------------------------------------------
- // METHODS
- //------------------------------------------------------------------
-
- /**
- * Constructor
- * @param aHandle -
- * @param aDocument -
- */
- public M2GSVGLocatableElement(int aHandle, M2GDocument aDocument)
- {
- super(aHandle, aDocument);
- }
-
- /**
- * @see org.w3c.dom.svg.SVGLocatableElement#getBBox()
- */
- public SVGRect getBBox()
- {
- M2GSVGRect bbox = new M2GSVGRect();
- M2GSVGElement._getBBox(getNativeSVGProxyHandle(), getHandle(),
- M2GSVGConstants.AT_BBOX, bbox.getComponents());
- // Checks element's type
- if ((iElementTypeId == M2GSVGConstants.EL_G) ||
- (iElementTypeId == M2GSVGConstants.EL_PATH) ||
- (iElementTypeId == M2GSVGConstants.EL_SVG))
- {
- if (bbox.isZero())
- {
- bbox = null;
- }
- }
- else if (iElementTypeId == M2GSVGConstants.EL_TEXT)
- {
- if ((bbox.getHeight()) == 0 && (bbox.getWidth() == 0))
- {
- bbox = null;
- }
- }
- return bbox;
- }
-
- /**
- * @see org.w3c.dom.svg.SVGLocatableElement#getScreenBBox()
- */
- public SVGRect getScreenBBox()
- {
- // Checks if this element is in DOM
- if (getDocument().isElementInDOM(getHandle()))
- {
- M2GSVGRect bbox = new M2GSVGRect();
- // Initializes M2GSVGRect components
- M2GSVGElement._getScreenBBox(
- getNativeSVGProxyHandle(),
- getHandle(),
- bbox.getComponents());
- return bbox;
- }
- return null;
- }
-
- /**
- * @see org.w3c.dom.svg.SVGLocatableElement#getScreenCTM()
- */
- public SVGMatrix getScreenCTM()
- {
- if (getDocument().isElementInDOM(getHandle()))
- {
- M2GSVGMatrix matrix = new M2GSVGMatrix();
- _getMatrixTrait(getNativeSVGProxyHandle(),
- getHandle(),
- M2GSVGConstants.EL_SVG, matrix.getComponents());
- return matrix;
- }
- return null;
- }
-}
--- a/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/M2GSVGMatrix.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,342 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-package com.nokia.microedition.m2g;
-
-import org.w3c.dom.svg.*;
-import org.w3c.dom.DOMException;
-
-/**
- * This interface represents an "SVGMatrix" datatype, identified by an affine transform.
- * It can be used to read and modify the values of transform attribute as per SVG specification.
- *
- * The transformation can be represented using matrix math on a 3x3 array.
- * Given (x,y), the transformation (x',y') can be found by:
- * [ x'] [ m00 m01 m02 ] [ x ] [ m00*x + m01*y + m02 ]
- * [ y'] = [ m10 m11 m12 ] [ y ] = [ m10*x + m11*y + m12 ]
- * [ 1 ] [ 0 0 1 ] [ 1 ] [ 1 ]
- *
- * The bottom row of the matrix is constant, so a transform can be uniquely
- * represented by "[[m00, m01, m02], [m10, m11, m12]]".
- */
-public class M2GSVGMatrix implements SVGMatrix
-{
- //--------------------------------------------------
- // STATIC CONSTANTS
- //--------------------------------------------------
- /* Optimization: static finals changed to local variables
- static private final String INVALID_INDEX_ESTR =
- "The index is invalid.";
- static private final String DET_IS_ZERO_ESTR =
- "The determinant of this matrix is zero.";
- */
- static final int ARRAY_SIZE = 6;
- // Array index
- static private final int M00 = 0;
- static private final int M10 = 1;
- static private final int M01 = 2;
- static private final int M11 = 3;
- static private final int M02 = 4;
- static private final int M12 = 5;
-
- //--------------------------------------------------
- // VARIABLES
- //--------------------------------------------------
- private float iComponents[];
-
- //--------------------------------------------------
- // METHODS
- //--------------------------------------------------
- /**
- * Construct a matrix with the following components:
- * <pre>
- * [1 0 0]
- * [0 1 0]
- * </pre>
- */
- protected M2GSVGMatrix()
- {
- iComponents = new float[ARRAY_SIZE];
- iComponents[M00] = iComponents[M11] = 1;
- }
-
- /**
- /**
- * Construct a matrix with the following components:
- * <pre>
- * [aM00 aM01 aM02]
- * [aM10 aM11 aM12]
- * </pre>
- * @param aM00 the x scaling component
- * @param aM10 the y shearing component
- * @param aM01 the x shearing component
- * @param aM11 the y scaling component
- * @param aM02 the x translation component
- * @param aM12 the y translation component
- */
- protected M2GSVGMatrix(float aM00, float aM10, float aM01,
- float aM11, float aM02, float aM12)
- {
- iComponents = new float[ARRAY_SIZE];
- iComponents[M00] = aM00;
- iComponents[M01] = aM01;
- iComponents[M02] = aM02;
- iComponents[M10] = aM10;
- iComponents[M11] = aM11;
- iComponents[M12] = aM12;
- }
-
- /**
- * Constructor
- * Create a new matrix by coping the given one.
- * @param aMatrix the matrix to copy
- * @throws NullPointerException if aMatrix is null
- * @throws DOMException if index sizes are not same
- */
- protected M2GSVGMatrix(M2GSVGMatrix aMatrix)
- {
- if (aMatrix == null)
- {
- throw new NullPointerException();
- }
- iComponents = new float[aMatrix.iComponents.length];
- for (int index = 0; index < iComponents.length; index++)
- {
- iComponents[index] = aMatrix.iComponents[index];
- }
- }
-
- /**
- * @see org.w3c.dom.svg.SVGMatrix#getComponent()
- */
- public float getComponent(int index) throws DOMException
- {
- if ((index < 0) || (index >= iComponents.length))
- {
- throw new DOMException(
- DOMException.INDEX_SIZE_ERR,
- /*SF*/"The index is invalid."/*SF*/);
- }
- return iComponents[index];
- }
-
- /**
- * Return the matrix of components used in this transform. The resulting
- * values are:
- * <pre>
- * [array[0] array[2] array[4]]
- * [array[1] array[3] array[5]]
- * </pre>
- * @return array that contains the matrix components.
- */
- float[] getComponents()
- {
- return iComponents;
- }
-
- /**
- * Get the matrix of components used in this transform. The resulting
- * values are:
- * <pre>
- * [aComponents[0] aComponents[2] aComponents[4]]
- * [aComponents[1] aComponents[3] aComponents[5]]
- * </pre>
- * @param aComponents Float array for matrix components
- */
- void getComponentsToArray(float[] aComponents)
- {
- if (aComponents == null)
- {
- return;
- }
- for (int index = 0; index < aComponents.length; index++)
- {
- aComponents[index] = iComponents[index];
- }
- }
-
- /**
- * Return the determinant of this transform matrix. If the determinant is
- * non-zero, the transform is invertible.
- * The determinant is calculated as:
- * <pre>
- * [m00 m01 m02]
- * [m10 m11 m12] = m00 * m11 - m01 * m10
- * [ 0 0 1 ]
- * </pre>
- * @return the determinant
- */
- public float getDeterminant()
- {
- return ((iComponents[M00] * iComponents[M11]) -
- (iComponents[M01] * iComponents[M10]));
- }
-
- /**
- * The inverse is calculated as:
- * <pre>
- * [m00 m01 m02]
- * M= [m10 m11 m12]
- * [ 0 0 1 ]
- *
- * 1 [ m11/det -m01/det (m01*m12-m02*m11)/det]
- * inverse(M)= --- x adjoint(M) = [-m10/det m00/det (m10*m02-m00*m12)/det]
- * det [ 0 0 1 ]
- * </pre>
- * @see org.w3c.dom.svg.SVGMatrix#inverse()
- */
- public SVGMatrix inverse() throws SVGException
- {
- // The inversion is useful for undoing transformations.
- float det = getDeterminant();
- if (det == 0)
- {
- throw new SVGException(
- SVGException.SVG_MATRIX_NOT_INVERTABLE,
- /*SF*/"The determinant of this matrix is zero."/*SF*/);
- }
- return new M2GSVGMatrix(
- iComponents[M11] / det, // iMtx[M00]
- (-iComponents[M10]) / det, // iMtx[M10]
- (-iComponents[M01]) / det, // iMtx[M01]
- iComponents[M00] / det, // iMtx[M11]
- ((iComponents[M01] * iComponents[M12]) - (iComponents[M02] * iComponents[M11])) / det, // iMtx[M02]
- ((iComponents[M10] * iComponents[M02]) - (iComponents[M00] * iComponents[M12])) / det); // iMtx[M12]
- }
-
- /**
- * The multiply is calculated as:
- * <pre>
- * [a00 a01 a02] [b00 b01 b02]
- * this=[a10 a11 a12] B=[b10 b11 b12]
- * [ 0 0 1 ] [ 0 0 1 ]
- *
- * [(a00*b00+a01*b10) (a00*b01+a01*b11) (a00*b02+a01*b12+a02)]
- * [this] = [this]x[B] = [(a10*b00+a11*b10) (a10*b01+a11*b11) (a10*b02+a11*b12+a12)]
- * [ 0 0 1 ]
- * </pre>
- * @see org.w3c.dom.svg.SVGMatrix#mMultiply()
- */
- public SVGMatrix mMultiply(SVGMatrix secondMatrix)
- {
- if (secondMatrix == null)
- {
- throw new NullPointerException();
- }
- M2GSVGMatrix b = (M2GSVGMatrix)secondMatrix;
- float a00 = iComponents[M00]; // a
- float a10 = iComponents[M10]; // b
- float a01 = iComponents[M01]; // c
- float a11 = iComponents[M11]; // d
- float a02 = iComponents[M02]; // e
- float a12 = iComponents[M12]; // f
- iComponents[M00] = (a00 * b.iComponents[M00]) + (a01 * b.iComponents[M10]); // a
- iComponents[M10] = (a10 * b.iComponents[M00]) + (a11 * b.iComponents[M10]); // b
- iComponents[M01] = (a00 * b.iComponents[M01]) + (a01 * b.iComponents[M11]); // c
- iComponents[M11] = (a10 * b.iComponents[M01]) + (a11 * b.iComponents[M11]); // d
- iComponents[M02] = (a00 * b.iComponents[M02]) + (a01 * b.iComponents[M12]) + a02; // e
- iComponents[M12] = (a10 * b.iComponents[M02]) + (a11 * b.iComponents[M12]) + a12; // f
- return this;
- }
-
- /**
- * The rotation is calculated as:
- * <pre>
- * [ cos(angle) -sin(angle) 0 ]
- * [this] x [ sin(angle) cos(angle) 0 ]
- * [ 0 0 1 ]
- * </pre>
- * @see org.w3c.dom.svg.SVGMatrix#mRotate()
- */
- public SVGMatrix mRotate(float angle)
- {
- if (angle % 360 == 0)
- {
- return this;
- }
- // must convert degrees to radians since java.lang.Math expects radians
- angle = angle * (float)Math.PI / 180.0f;
- float c = (float)Math.cos(angle);
- float s = (float)Math.sin(angle);
- float m00 = iComponents[M00];
- float m10 = iComponents[M10];
- float m01 = iComponents[M01];
- float m11 = iComponents[M11];
- iComponents[M00] = m00 * c + m01 * s;
- iComponents[M10] = m10 * c + m11 * s;
- iComponents[M01] = m01 * c - m00 * s;
- iComponents[M11] = m11 * c - m10 * s;
- return this;
- }
-
- /**
- * The multiply is calculated as:
- * <pre>
- * [m00 m01 m02] [scaleFactor 0 0]
- * this=[m10 m11 m12] B=[ 0 scaleFactor 0]
- * [ 0 0 1 ] [ 0 0 1]
- *
- * [(a00*scaleFactor) (a01*scaleFactor) a02]
- * [this] = [this]x[B] = [(a10*scaleFactor) (a11*scaleFactor) a12]
- * [ 0 0 1 ]
- * </pre>
- * @see org.w3c.dom.svg.SVGMatrix#mScale()
- */
- public SVGMatrix mScale(float scaleFactor)
- {
- if (scaleFactor == 1)
- {
- return this;
- }
- iComponents[M00] *= scaleFactor;
- iComponents[M01] *= scaleFactor;
- iComponents[M10] *= scaleFactor;
- iComponents[M11] *= scaleFactor;
- return this;
- }
-
- /**
- * @see org.w3c.dom.svg.SVGMatrix#mTranslate()
- */
- public SVGMatrix mTranslate(float x, float y)
- {
- if (x == 0 && y == 0)
- {
- return this;
- }
- iComponents[M02] += (iComponents[M00] * x) + (iComponents[M01] * y);
- iComponents[M12] += (iComponents[M10] * x) + (iComponents[M11] * y);
- return this;
- }
-
- /**
- * To string
- */
- static String toString(float aComponents[])
- {
- if ((aComponents == null) || (M2GSVGMatrix.ARRAY_SIZE != aComponents.length))
- {
- return "";
- }
- StringBuffer buf = new StringBuffer();
- buf.append("[00]:").append(aComponents[M00]).append(", [10]:").append(aComponents[M10]);
- buf.append(", [01]:").append(aComponents[M01]).append(", [11]:").append(aComponents[M11]);
- buf.append(", [02]:").append(aComponents[M02]).append(", [12]:").append(aComponents[M12]);
- return buf.toString();
- }
-}
--- a/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/M2GSVGPath.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,263 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-package com.nokia.microedition.m2g;
-
-import org.w3c.dom.svg.*;
-import org.w3c.dom.DOMException;
-import java.io.IOException;
-import com.nokia.mj.impl.utils.Logger;
-
-/**
- * This interface represents an "SVGPath" datatype used to define the path geometry.
- * Corresponds to SVG path specification or the "d" attribute.
- */
-public class M2GSVGPath extends M2GObject implements SVGPath
-{
- //--------------------------------------------------
- // STATIC CONTANTS
- //--------------------------------------------------
- /* Optimization: static finals changed to local variables
- private static final String SEGMENT_INDEX_SIZE_ESTR =
- "The segment index is out of bounds.";
- private static final String PARAMETER_INDEX_SIZE_ESTR =
- "The parameter index is out of bounds for this segment's type.";
- */
- private static final int CLOSE_PARAMETER_COUNT = 0;
- private static final int MOVE_TO_PARAMETER_COUNT = 2;
- private static final int LINE_TO_PARAMETER_COUNT = 2;
- private static final int CURVE_TO_PARAMETER_COUNT = 6;
- private static final int QUAD_TO_PARAMETER_COUNT = 4;
-
- //--------------------------------------------------
- // VARIABLES
- //--------------------------------------------------
-
- //--------------------------------------------------
- // METHODS
- //--------------------------------------------------
-
- /**
- * Constructor
- * @param aHandle - native path object handle
- * @param aDoCleanup - true if the native object needed to be deleted
- */
- protected M2GSVGPath(int aHandle)
- {
- super();
- setHandle(aHandle);
- doConstruct();
- }
-
- /**
- * @see com.nokia.microedition.m2g.M2GObject#doCheckValidity()
- */
- public boolean doCheckValidity()
- {
- // SVGPath is invalid if it begins with any segment other
- // than MOVE_TO segment. Note that an empty SVGPath is still a valid value.
- try
- {
- if (!super.doCheckValidity() ||
- ((getNumberOfSegments() != 0) && (getSegment(0) != MOVE_TO)))
- {
- return false;
- }
- }
- catch (IOException e)
- {
- return false;
- }
- return true;
- }
-
- /**
- * @see com.nokia.microedition.m2g.M2GObject#doCleanup()
- */
- protected void doCleanup()
- {
- _destroyPath(getNativeSVGProxyHandle(),
- getHandle());
- resetHandles();
- }
-
- /**
- * @see com.nokia.microedition.m2g.M2GObject#doConstruct()
- */
- protected void doConstruct()
- {
- super.doConstruct();
- register(this);
- }
-
-
- /**
- * @see org.w3c.dom.svg.SVGPath#getNumberOfSegments()
- */
- public int getNumberOfSegments()
- {
- return _getNumberOfSegments(getNativeSVGProxyHandle(),
- getHandle() );
- }
-
- /**
- * @see org.w3c.dom.svg.SVGPath#getSegment()
- */
- public short getSegment(int index) throws DOMException
- {
- if ((index < 0) ||
- (index >= getNumberOfSegments()))
- {
- Logger.ELOG(Logger.EJavaUI, "getSegment() - exception:"
- + /*SF*/"The segment index is out of bounds."/*SF*/);
- throw new DOMException(
- DOMException.INDEX_SIZE_ERR,
- /*SF*/"The segment index is out of bounds."/*SF*/);
- }
- return M2GSVGConstants.parsePathCommand(
- _getSegmentType(getNativeSVGProxyHandle(),
- getHandle(),
- index)
- );
- }
-
- /**
- * Checks that parameter index is valid
- * @param aCommand -
- * @param aParameterIndex -
- */
- protected void checkParameterIndex(int aCommand, int aParameterIndex) throws DOMException
- {
- if ((aCommand == CLOSE && aParameterIndex >= CLOSE_PARAMETER_COUNT) ||
- (aCommand == MOVE_TO && aParameterIndex >= MOVE_TO_PARAMETER_COUNT)
- || (aCommand == LINE_TO && aParameterIndex >= LINE_TO_PARAMETER_COUNT)
- || (aCommand == CURVE_TO && aParameterIndex >= CURVE_TO_PARAMETER_COUNT)
- || (aCommand == QUAD_TO && aParameterIndex >= QUAD_TO_PARAMETER_COUNT))
- {
- throw new DOMException(
- DOMException.INDEX_SIZE_ERR,
- /*SF*/"The parameter index is out of bounds for this segment's type."/*SF*/);
- }
- }
-
- /**
- * @see org.w3c.dom.svg.SVGPath#close()
- */
- public void close()
- {
- _addClose(getNativeSVGProxyHandle(), getHandle());
- }
-
- /**
- * @see org.w3c.dom.svg.SVGPath#curveTo()
- */
- public void curveTo(float x1, float y1, float x2, float y2, float x3, float y3)
- {
- _addCurveTo(getNativeSVGProxyHandle(),
- getHandle(), x1, y1, x2, y2, x3, y3);
- }
-
- /**
- * @see org.w3c.dom.svg.SVGPath#getSegmentParam()
- */
- public float getSegmentParam(int cmdIndex, int paramIndex)
- {
- if ((cmdIndex >= getNumberOfSegments()) ||
- (cmdIndex < 0) ||
- (paramIndex < 0))
- {
- Logger.ELOG(Logger.EJavaUI, "getSegmentParam() - end, exception:"
- + /*SF*/"The segment index is out of bounds."/*SF*/);
- throw new DOMException(
- DOMException.INDEX_SIZE_ERR,
- /*SF*/"The segment index is out of bounds."/*SF*/);
- }
- short command = getSegment(cmdIndex);
- // Checks the validity of the parameter index.
- checkParameterIndex(command, paramIndex);
- return _getSegmentParameter(getNativeSVGProxyHandle(),
- getHandle(),
- cmdIndex,
- paramIndex
- );
- }
-
- /**
- * @see org.w3c.dom.svg.SVGPath#lineTo()
- */
- public void lineTo(float x, float y)
- {
- _addLineTo(getNativeSVGProxyHandle(), getHandle(), x, y);
- }
-
- /**
- * @see org.w3c.dom.svg.SVGPath#moveTo()
- */
- public void moveTo(float x, float y)
- {
- _addMoveTo(getNativeSVGProxyHandle(), getHandle(), x, y );
- }
-
- /**
- * @see org.w3c.dom.svg.SVGPath#quadTo()
- */
- public void quadTo(float x1, float y1, float x2, float y2)
- {
- _addQuadTo(getNativeSVGProxyHandle(),
- getHandle(),
- x1,
- y1,
- x2,
- y2 );
- }
-
- //--------------------------------------------------
- // NATIVE METHODS
- //--------------------------------------------------
- private static native void _addClose(
- int aSVGProxyHandle, int aPathHandle);
-
- private static native void _addCurveTo(
- int aSVGProxyHandle, int aPathHandle,
- float aX1, float aY1, float aX2, float aY2, float aX3, float aY3);
-
- private static native void _addLineTo(
- int aSVGProxyHandle, int aPathHandle, float aX, float aY);
-
- private static native void _addMoveTo(
- int aSVGProxyHandle, int aPathHandle, float aX, float aY);
-
- private static native void _addQuadTo(
- int aSVGProxyHandle, int aPathHandle,
- float aX1, float aY1, float aX2, float aY2);
-
- static native int _createPath(
- int aSVGProxyHandle);
-
- private static native void _destroyPath(
- int aSVGProxyHandle, int aPathHandle);
-
- private static native int _getNumberOfSegments(
- int aSVGProxyHandle, int aPathHandle);
-
- private static native float _getSegmentParameter(
- int aSVGProxyHandle, int aPathHandle, int aCmdIndex, int aParamIndex);
-
- private static native short _getSegmentType(
- int aSVGProxyHandle, int aPathHandle, int aIndex);
-}
-
--- a/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/M2GSVGPoint.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,130 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-package com.nokia.microedition.m2g;
-
-import org.w3c.dom.svg.*;
-
-/**
- * This interface represents an "SVGPoint" datatype,
- * identified by its x and y components.
- */
-public class M2GSVGPoint implements SVGPoint
-{
- //--------------------------------------------------
- // VARIABLES
- //--------------------------------------------------
- private M2GSVGSVGElement iElement;
- private float iX;
- private float iY;
-
- //--------------------------------------------------
- // METHODS
- //--------------------------------------------------
- /**
- * Constructor
- * @param aRootElement
- */
- protected M2GSVGPoint(M2GSVGSVGElement aElement)
- {
- iElement = aElement;
- iX = 0;
- iY = 0;
- }
-
- /**
- * Check set validity
- * @param aValue Value
- * @return true if setting can be done
- */
- protected boolean check(float aValue)
- {
- if (Float.isNaN(aValue))
- {
- // throw IllegalArgumentException();
- return false;
- }
- if (iElement != null)
- {
- String zoomAndPan = iElement.getTrait("zoomAndPan");
- if ((zoomAndPan != null) && zoomAndPan.equals("disable"))
- {
- return false;
- }
- return true;
- }
- return false;
- }
-
- /**
- * @see org.w3c.dom.svg.SVGPath#getX()
- */
- public float getX()
- {
- synchronized (this)
- {
- return iX;
- }
- }
-
- /**
- * @see org.w3c.dom.svg.SVGPath#getX()
- */
- public float getY()
- {
- synchronized (this)
- {
- return iY;
- }
- }
-
- /**
- * @see org.w3c.dom.svg.SVGPath#setX()
- */
- public void setX(float value)
- {
- synchronized (this)
- {
- if (check(value))
- {
- iX = value;
- if (iElement != null)
- {
- iElement.updateTransformMatrix();
- }
- }
- }
- }
-
- /**
- * @see org.w3c.dom.svg.SVGPath#setY()
- */
- public void setY(float value)
- {
- synchronized (this)
- {
- if (check(value))
- {
- iY = value;
- if (iElement != null)
- {
- iElement.updateTransformMatrix();
- }
- }
- }
- }
-}
--- a/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/M2GSVGRGBColor.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,124 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-package com.nokia.microedition.m2g;
-
-import org.w3c.dom.svg.*;
-
-public class M2GSVGRGBColor implements SVGRGBColor
-{
- //--------------------------------------------------
- // STATIC CONSTANTS
- //--------------------------------------------------
- private static final int R = 0;
- private static final int G = 1;
- private static final int B = 2;
- // Exception text
- private static final String OUT_OF_RANGE_ESTR =
- "Color values out of range.";
-
- //--------------------------------------------------
- // VARIABLES
- //--------------------------------------------------
- private int[] iComponents;
-
- //--------------------------------------------------
- // METHODS
- //--------------------------------------------------
-
- /**
- * Constructor. Defualt color is black.
- v */
- public M2GSVGRGBColor()
- {
- iComponents = new int[3];
- iComponents[R] = 0;
- iComponents[G] = 0;
- iComponents[B] = 0;
- }
-
- /**
- * Constructor
- * @param aR -
- v * @param aG -
- v * @param aB -
- v */
- public M2GSVGRGBColor(int aR, int aG, int aB) throws SVGException
- {
- checkValues(aR, aG, aB);
- iComponents = new int[3];
- iComponents[R] = aR;
- iComponents[G] = aG;
- iComponents[B] = aB;
- }
-
- /**
- * Checks value range
- * @param aR
- * @param aG
- * @param aB
- */
- protected void checkValues(int aR, int aG, int aB) throws SVGException
- {
- if (((aR > 255) || (aR < 0)) ||
- ((aG > 255) || (aG < 0)) ||
- ((aB > 255) || (aB < 0)))
- {
- throw new SVGException(
- SVGException.SVG_INVALID_VALUE_ERR, OUT_OF_RANGE_ESTR);
- }
- }
-
- /**
- * Gets components
- * @return components
- */
- int[] getComponents()
- {
- return iComponents;
- }
-
- /**
- * @see org.w3c.dom.svg.SVGRGBColor#getRed()
- */
- public int getRed()
- {
- return iComponents[R];
- }
-
- /**
- * @see org.w3c.dom.svg.SVGRGBColor#getGreen()
- */
- public int getGreen()
- {
- return iComponents[G];
- }
-
- /**
- * @see org.w3c.dom.svg.SVGRGBColor#getBlue()
- */
- public int getBlue()
- {
- return iComponents[B];
- }
-
- public String toString()
- {
- return "SVGRGBColor( r = " + iComponents[R] + ", g = " +
- iComponents[G] + ", b = " + iComponents[B] + " )";
- }
-}
--- a/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/M2GSVGRect.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,161 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-package com.nokia.microedition.m2g;
-
-import org.w3c.dom.svg.*;
-
-/**
- * This interface represents an "SVGRect" datatype, consisting of a minimum X, minimum Y, width
- * and height values.
- */
-public class M2GSVGRect implements SVGRect
-{
- //--------------------------------------------------
- // STATIC CONSTANTS
- //--------------------------------------------------
- private static final int X = 0;
- private static final int Y = 1;
- private static final int W = 2;
- private static final int H = 3;
-
- //--------------------------------------------------
- // VARIABLES
- //--------------------------------------------------
- private float[] iComponents;
-
- //--------------------------------------------------
- // METHODS
- //--------------------------------------------------
- /**
- * Contructor
- */
- protected M2GSVGRect()
- {
- iComponents = new float[4];
- iComponents[X] = 0;
- iComponents[Y] = 0;
- iComponents[W] = 0;
- iComponents[H] = 0;
- }
-
- /**
- * Contructor
- * @param aX -
- * @param aY -
- * @param aWidth -
- * @param aHeight -
- */
- protected M2GSVGRect(float aX, float aY, float aWidth, float aHeight)
- {
- iComponents = new float[4];
- iComponents[X] = aX;
- iComponents[Y] = aY;
- iComponents[W] = aWidth;
- iComponents[H] = aHeight;
- }
-
- /**
- * Returns reference to a components
- * @return components
- */
- float[] getComponents()
- {
- return iComponents;
- }
-
- /**
- * @see org.w3c.dom.svg.SVGRect#getX()
- */
- public float getX()
- {
- return iComponents[X];
- }
-
- /**
- * @see org.w3c.dom.svg.SVGRect#getY()
- */
- public float getY()
- {
- return iComponents[Y];
- }
-
- /**
- * @see org.w3c.dom.svg.SVGRect#getWidth()
- */
- public float getWidth()
- {
- return iComponents[W];
- }
-
- /**
- * @see org.w3c.dom.svg.SVGRect#getHeight()
- */
- public float getHeight()
- {
- return iComponents[H];
- }
-
- /**
- * Checks if all components are zero
- * @returns true is every component is zero
- */
- public boolean isZero()
- {
- for (int index = 0; index < iComponents.length; index++)
- {
- if (iComponents[index] != 0)
- {
- return false;
- }
- }
- return true;
- }
-
- /**
- * @see org.w3c.dom.svg.SVGRect#setX()
- */
- public void setX(float value)
- {
- iComponents[X] = value;
- }
-
- /**
- * @see org.w3c.dom.svg.SVGRect#setY()
- */
- public void setY(float value)
- {
- iComponents[Y] = value;
- }
-
- /**
- * @see org.w3c.dom.svg.SVGRect#setWidth()
- */
- public void setWidth(float value)
- {
- iComponents[W] = value;
- }
-
- /**
- * @see org.w3c.dom.svg.SVGRect#setHeight()
- */
- public void setHeight(float value)
- {
- iComponents[H] = value;
- }
-}
--- a/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/M2GSVGSVGElement.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,406 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-package com.nokia.microedition.m2g;
-
-import org.w3c.dom.*;
-import org.w3c.dom.svg.*;
-import java.io.IOException;
-import com.nokia.mj.impl.utils.Logger;
-
-public class M2GSVGSVGElement extends M2GSVGLocatableElement implements SVGSVGElement
-{
- //--------------------------------------------------
- // STATIC CONSTANTS
- //--------------------------------------------------
- /* Optimization: static finals changed to local variables
- public static final String INVALID_SVG_VERSION_ESTR =
- "Invalid version.";
- public static final String INVALID_SVG_BASE_PROFILE_ESTR =
- "Invalid base profile.";
- */
-
- //------------------------------------------------------------------
- // VARIABLES
- //------------------------------------------------------------------
- // Exception text
- public static final String SCALE_BY_ZERO =
- "Cannot scale by 0.";
-
- //------------------------------------------------------------------
- // VARIABLES
- //------------------------------------------------------------------
- private Object iTimeGuard;
- private M2GSVGMatrix iMatrix;
- private M2GSVGPoint iCurrentTranslatePoint;
- private float iCurrentRotate;
- private float iCurrentScale;
- private float iCurrentTimeInSeconds;
-
- //------------------------------------------------------------------
- // METHODS
- //------------------------------------------------------------------
- /**
- * Constructor
- * @param aHandle -
- * @param aDocument -
- */
- protected M2GSVGSVGElement(int aHandle, M2GDocument aDocument)
- {
- super(aHandle, aDocument);
- iTimeGuard = new Object();
- iMatrix = (M2GSVGMatrix)createSVGMatrixComponents(1f, 0f, 0f, 1f, 0f, 0f);
- iCurrentTranslatePoint = new M2GSVGPoint(this);
- iCurrentRotate = 0.0f;
- iCurrentScale = 1.0f;
- iCurrentTimeInSeconds = 0.0f;
- refreshMatrix();
- }
-
- /**
- * @see org.w3c.dom.svg.SVGSVGElement#createSVGMatrixComponents()
- */
- public SVGMatrix createSVGMatrixComponents(
- float a, float b, float c, float d, float e, float f)
- {
- return new M2GSVGMatrix(a, b, c, d, e, f);
- }
-
- /**
- * @see org.w3c.dom.svg.SVGSVGElement#createSVGMatrixComponents()
- */
- public SVGPath createSVGPath()
- {
- return new M2GSVGPath(
- M2GSVGPath._createPath(getNativeSVGProxyHandle()));
- }
-
- /**
- * @see org.w3c.dom.svg.SVGSVGElement#createSVGRect()
- */
- public SVGRect createSVGRect()
- {
- return new M2GSVGRect();
- }
-
- /**
- * @see org.w3c.dom.svg.SVGSVGElement#SVGRGBColor()
- */
- public SVGRGBColor createSVGRGBColor(int red, int green, int blue)
- {
- return new M2GSVGRGBColor(red, green, blue);
- }
-
- /**
- * @see com.nokia.microedition.m2g.M2GObject#doCleanup()
- */
- protected void doCleanup()
- {
- // Note this method is not automatically called if
- // doConstruct() method is not first called
- super.doCleanup();
- }
-
- /**
- * @see com.nokia.microedition.m2g.M2GObject#getCurrentRotate()
- */
- public float getCurrentRotate()
- {
- synchronized (this)
- {
- return iCurrentRotate;
- }
- }
-
- /**
- * @see com.nokia.microedition.m2g.M2GObject#getCurrentScale()
- */
- public float getCurrentScale()
- {
- synchronized (this)
- {
- return iCurrentScale;
- }
- }
-
- /**
- * @see com.nokia.microedition.m2g.M2GObject#getCurrentTime()
- */
- public float getCurrentTime()
- {
- synchronized (iTimeGuard)
- {
- return iCurrentTimeInSeconds;
- }
- }
-
- /**
- * @see com.nokia.microedition.m2g.M2GObject#getCurrentTranslate()
- */
- public SVGPoint getCurrentTranslate()
- {
- return iCurrentTranslatePoint;
- }
-
- /**
- * @org.w3c.dom.Node#getParentNode()
- */
- public Node getParentNode()
- {
- // Optimization: if(!getDocument().getConnectionPolicy().getAccessRight())
- if (!iDocument.iConnectionRight)
- {
- Logger.ELOG(Logger.EJavaUI, "getParentNode() - access rights failure");
- throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
- }
- return null;
- }
-
- /**
- * Check svg version and base profile
- * @throws IOException If version or profile is invalid
- */
- public void checkVersionAndProfile() throws IOException
- {
- // Check version
- String trait = _getStringTrait(
- getNativeSVGProxyHandle(),
- getHandle(),
- M2GSVGConstants.AT_VERSION);
- if (trait != null && (!trait.equals(
- M2GSVGConstants.getInstance().iSvgBaseProfileVersion)))
- {
- Logger.ELOG(Logger.EJavaUI, "doCheckValidity() - excption: svg version");
- throw new IOException(/*SF*/"Invalid version."/*SF*/);
- }
- // Check profile
- trait = _getStringTrait(
- getNativeSVGProxyHandle(),
- getHandle(),
- M2GSVGConstants.AT_BASEPROFILE);
- if (trait != null && (!trait.equals(
- M2GSVGConstants.getInstance().iSvgBaseProfileName)))
- {
- Logger.ELOG(Logger.EJavaUI, "doCheckValidity() - excption: svg base profile");
- throw new IOException(/*SF*/"Invalid base profile."/*SF*/);
- }
- }
-
- /**
- * @javax.microedition.m2g.SVGImage#incrementTime()
- */
- public void incrementTime(float seconds)
- {
- incrementTimeNoUpdate(seconds);
- // update the media time to SVG engine
- updateTime();
- }
-
- /**
- * Increments the animation or media timeline for this SVGImage (in seconds)
- * but it does not update it to the SVG engine
- *
- * @note the time is updated to the engine during M2GScalableGraphics.RenderFrame()
- * @param seconds the value of time to increment in seconds
- *
- * @since S60 3.1
- */
- public void incrementTimeNoUpdate(float seconds)
- {
- if (seconds < 0)
- {
- throw new IllegalArgumentException();
- }
-
- if (Float.isNaN(iCurrentTimeInSeconds + seconds))
- {
- throw new IllegalArgumentException();
- }
-
- synchronized (iTimeGuard)
- {
- iCurrentTimeInSeconds += seconds;
- }
- }
-
- /**
- * Sets matrix trait
- */
- protected void refreshMatrix()
- {
- float matrixComponents[] = new float[M2GSVGMatrix.ARRAY_SIZE];
-
- synchronized (this)
- {
- iMatrix.getComponentsToArray(matrixComponents);
- }
-
- M2GSVGElement._setMatrixTrait(
- getNativeSVGProxyHandle(), getHandle(),
- M2GSVGConstants.AT_TRANSFORM, matrixComponents);
-
- // inform observer about changes in DOM
- iDocument.notifyDOMChangeObserver();
- }
-
- /**
- * Updates the time to engine
- */
- private void updateTime()
- {
- float currentTimeInSeconds = 0.0f;
-
- synchronized (iTimeGuard)
- {
- currentTimeInSeconds = iCurrentTimeInSeconds;
- }
-
- _setMediaTime(getNativeSVGProxyHandle(),
- getDocument().getHandle(), currentTimeInSeconds);
-
- // inform observer about changes in DOM
- iDocument.notifyDOMChangeObserver();
- }
-
- /**
- * @see com.nokia.microedition.m2g.M2GObject#setCurrentRotate()
- */
- public void setCurrentRotate(float value)
- {
- String zoomAndPan = getTrait("zoomAndPan");
- if ((zoomAndPan != null) && zoomAndPan.equals("disable"))
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "setCurrentRotate() - zoomAndPan:" + zoomAndPan + ", fail");
- return;
- }
- synchronized (this)
- {
- iCurrentRotate = value;
- updateTransformMatrix();
- }
- }
-
- /**
- * @see com.nokia.microedition.m2g.M2GObject#setCurrentScale()
- */
- public void setCurrentScale(float value)
- {
- String zoomAndPan = getTrait("zoomAndPan");
- if ((zoomAndPan != null) && zoomAndPan.equals("disable"))
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "setCurrentScale() - zoomAndPan:" + zoomAndPan + ", fail");
- return;
- }
- if (value == 0)
- {
- throw new DOMException(DOMException.INVALID_ACCESS_ERR, SCALE_BY_ZERO);
- }
- synchronized (this)
- {
- iCurrentScale = value;
- updateTransformMatrix();
- }
- }
-
- /**
- * @see org.w3c.dom.svg.SVGSVGElement#setCurrentTime()
- * @note no support for setting the time backwards except for setting it to zero
- * @note engine resets the animation if current time is zero
- */
- public void setCurrentTime(float newSeconds)
- {
- synchronized (iTimeGuard)
- {
- if (newSeconds <= iCurrentTimeInSeconds && newSeconds != 0)
- {
- // only forward time or zero time is accepted
- return;
- }
-
- iCurrentTimeInSeconds = newSeconds;
- }
-
- updateTime();
- }
-
- /**
- * <pre>
- * [currentScale 0 currentTranslate.x] [cos(currentRotate) -sin(currentRotate 0]
- * [ 0 currentScale currentTranslate.y] x [sin(currentRotate) cos(currentRotate) 0]
- * [ 0 0 1 ] [ 0 0 1]
- * </pre>
- */
- public void updateTransformMatrix()
- {
- synchronized (this)
- {
- M2GSVGMatrix a = new M2GSVGMatrix(
- iCurrentScale, 0f, 0f, iCurrentScale,
- iCurrentTranslatePoint.getX(), iCurrentTranslatePoint.getY());
- M2GSVGMatrix b = new M2GSVGMatrix(
- (float)Math.cos(iCurrentRotate *(float)Math.PI / 180.0f),
- (float)Math.sin(iCurrentRotate *(float)Math.PI / 180.0f),
- -(float)Math.sin(iCurrentRotate *(float)Math.PI / 180.0f),
- (float)Math.cos(iCurrentRotate *(float)Math.PI / 180.0f),
- 0f, 0f);
- iMatrix = (M2GSVGMatrix)(a.mMultiply(b));
- refreshMatrix();
- }
- }
-
- //------------------------------------------------------------------
- // STATIC METHODS
- //------------------------------------------------------------------
- /**
- * Builds root element according to a document
- * @param aDocument
- * @return root element
- */
- public static M2GSVGSVGElement buildRootElement(M2GDocument aDocument)
- {
- // Get native handle
- int elementHandle = M2GSVGElement._getRootElement(
- aDocument.getNativeSVGProxyHandle(),
- aDocument.getHandle());
- // Check native handle
- if (!M2GObject.checkHandle(elementHandle))
- {
- return null;
- }
- // Create object
- M2GSVGSVGElement rootElement =
- new M2GSVGSVGElement(elementHandle, aDocument);
- if (rootElement != null)
- {
- // Register element
- aDocument.registerLiveElement(rootElement, new Integer(elementHandle));
- }
- return rootElement;
- }
-
- //------------------------------------------------------------------
- // NATIVE METHODS
- //------------------------------------------------------------------
- protected native static float _getMediaTime(
- int aSvgProxyHandle, int aDocumentHandle);
- private native static void _setMediaTime(
- int aSvgProxyHandle, int aDocumentHandle,
- float aSeconds );
-}
-
--- a/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/M2GSVGeSWTAnimator.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,261 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-package com.nokia.microedition.m2g;
-
-import javax.microedition.m2g.*;
-import org.eclipse.swt.widgets.SVGAnimatorControl;
-import com.nokia.mj.impl.rt.support.Finalizer;
-import com.nokia.mj.impl.utils.Logger;
-
-public class M2GSVGeSWTAnimator extends SVGAnimator
-{
- //--------------------------------------------------
- // STATIC CONSTANTS
- //--------------------------------------------------
- private static final String ANIMATOR_CONTROL_BASE_CLASS =
- "org.eclipse.swt.widgets.Canvas";
-
- // Exception text
- /* Optimization: static finals changed to local variables
- private static final String COMPONENT_BASE_CLASS_NOT_SUPPORTED_ESTR =
- "The requested componentBaseClass is not supported by the implementation.";
- private static final String ILLEGAL_TIME_INCREMENT_ESTR =
- "The timeIncrement is less than or equal to zero.";
- private static final String ANIMATOR_PLAY_ESTR =
- "The animator is not currently in the stopped or paused state.";
- private static final String ANIMATOR_PAUSE_ESTR =
- "The animator is not in the playing state.";
- private static final String ANIMATOR_STOP_ESTR =
- "The animator is not in the playing or paused state.";
- private static final String INVALID_RUNNABLE_ESTR =
- "The runnable is null.";
- private static final String ANIMATOR_IS_STOPPED_ESTR =
- "The animator is in the stopped state.";
- private static final String RUNNABLE_IS_NULL_ESTR =
- "The runnable is null.";
- private static final String ANIMATOR_INVOKE_ESTR =
- "The animator is in the stopped state.";
- */
-
- //--------------------------------------------------
- // VARIABLES
- //--------------------------------------------------
- private SVGAnimatorControl iAnimatorControl;
-
- private Finalizer mFinalizer = new Finalizer()
- {
- public void finalizeImpl()
- {
- doFinalize();
- }
- };
-
- //--------------------------------------------------
- // METHODS
- //--------------------------------------------------
- /**
- * Constructor
- * @param aImage
- */
- protected M2GSVGeSWTAnimator(SVGImage aImage)
- {
- iAnimatorControl = new SVGAnimatorControl(/*false,*/ aImage);
- }
-
- /**
- * @see javax.microedition.m2g.SVGAnimator#getTargetComponent()
- */
- public Object getTargetComponent()
- {
- return iAnimatorControl;
- }
-
- /**
- * @see javax.microedition.m2g.SVGAnimator#getTimeIncrement()
- */
- public float getTimeIncrement()
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "getTimeIncrement() " + iAnimatorControl.getTimeIncrement());
- return iAnimatorControl.getTimeIncrement();
- }
-
- /**
- * @see javax.microedition.m2g.SVGAnimator#invokeAndWait()
- */
- public void invokeAndWait(java.lang.Runnable runnable)
- {
- if (runnable == null)
- {
- throw new NullPointerException(
- /*SF*/"The runnable is null."/*SF*/);
- }
- if (iAnimatorControl.isStopped())
- {
- throw new IllegalStateException(
- /*SF*/"The animator is in the stopped state."/*SF*/);
- }
- Logger.LOG(Logger.EJavaUI, Logger.EInfo, "invokeAndWait()");
-
- runnable.run();
- }
-
- /**
- * @see javax.microedition.m2g.SVGAnimator#invokeLater()
- */
- public void invokeLater(java.lang.Runnable runnable)
- {
- if (runnable == null)
- {
- throw new NullPointerException(
- /*SF*/"The runnable is null."/*SF*/);
- }
- if (iAnimatorControl.isStopped())
- {
- throw new IllegalStateException(
- /*SF*/"The animator is in the stopped state."/*SF*/);
- }
- Logger.LOG(Logger.EJavaUI, Logger.EInfo, "invokeLater()");
- Thread thread = new Thread(runnable);
- thread.start();
- }
-
- /**
- * @see javax.microedition.m2g.SVGAnimator#pause()
- */
- public void pause()
- {
- if (!iAnimatorControl.isPlaying())
- {
- throw new IllegalStateException(
- /*SF*/"The animator is not in the playing or paused state."/*SF*/);
- }
- Logger.LOG(Logger.EJavaUI, Logger.EInfo, "pause()");
- iAnimatorControl.pause();
- }
-
- /**
- * @see javax.microedition.m2g.SVGAnimator#play()
- */
- public void play()
- {
- if (iAnimatorControl.isPlaying())
- {
- throw new IllegalStateException(
- /*SF*/"The animator is not currently in the stopped or paused state."/*SF*/);
- }
- Logger.LOG(Logger.EJavaUI, Logger.EInfo, "play()");
- iAnimatorControl.play();
- }
-
- private void doFinalize()
- {
- if (mFinalizer != null)
- {
- registeredFinalize();
- mFinalizer = null;
- }
- }
-
- /**
- * Finalize
- */
- synchronized void registeredFinalize()
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo, "registeredFinalize()");
- iAnimatorControl = null;
- }
-
- /**
- * @see javax.microedition.m2g.SVGAnimator#setSVGEventListener()
- */
- public void setSVGEventListener(SVGEventListener svgEventListener)
- {
- iAnimatorControl.setEventListener(svgEventListener);
- }
-
- /**
- * @see javax.microedition.m2g.SVGAnimator#setTimeIncrement()
- */
- public void setTimeIncrement(float timeIncrement)
- {
- if (timeIncrement <= 0)
- {
- throw new IllegalArgumentException(
- /*SF*/"The time increment is less than or equal to zero."/*SF*/);
- }
- Logger.LOG(Logger.EJavaUI, Logger.EInfo, "setTimeIncrement() - " + timeIncrement);
- iAnimatorControl.setTimeIncrement(timeIncrement);
- }
-
- /**
- * @see javax.microedition.m2g.SVGAnimator#stop()
- */
- public void stop()
- {
- if (iAnimatorControl.isStopped())
- {
- throw new IllegalStateException(
- /*SF*/"The animator is not in the playing or paused state."/*SF*/);
- }
- Logger.LOG(Logger.EJavaUI, Logger.EInfo, "stop()");
- iAnimatorControl.stop();
- }
-
- //--------------------------------------------------
- // STATIC METHODS
- //--------------------------------------------------
- /**
- * Builds animator
- * @param svgImage -
- * @return SVGAnimator
- * @see javax.microedition.m2g.SVGAnimator#createAnimator()
- */
- public static SVGAnimator buildAnimator(SVGImage svgImage)
- {
- if (svgImage == null)
- {
- throw new NullPointerException();
- }
- return new M2GSVGeSWTAnimator(svgImage);
- }
-
- /**
- * Builds animator
- * @param svgImage -
- * @param componentBaseClass -
- * @return SVGAnimator
- * @see javax.microedition.m2g.SVGAnimator#createAnimator()
- */
- public static SVGAnimator buildAnimator(
- SVGImage svgImage, String componentBaseClass)
- {
- if (svgImage == null)
- {
- throw new NullPointerException();
- }
- if ((componentBaseClass != null) &&
- (!componentBaseClass.equals(ANIMATOR_CONTROL_BASE_CLASS)))
- {
- throw new IllegalArgumentException(
- /*SF*/"The requested componentBaseClass is not supported by the implementation."/*SF*/);
- }
-
- return buildAnimator(svgImage);
- }
-}
--- a/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/M2GScalableGraphics.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,446 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-package com.nokia.microedition.m2g;
-
-import com.nokia.microedition.m2g.M2GRunnableQt;
-import javax.microedition.m2g.*;
-import javax.microedition.m2g.ScalableGraphics;
-import javax.microedition.lcdui.Graphics;
-import java.lang.StringBuffer;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Rectangle;
-import com.nokia.mj.impl.utils.Logger;
-import com.nokia.mj.impl.nokialcdui.LCDUIInvoker;
-import org.eclipse.swt.internal.qt.GCData;
-import org.eclipse.swt.internal.qt.graphics.GraphicsContext;
-
-
-/*
- * ScalableGraphics
- */
-public class M2GScalableGraphics
- extends M2GObject
-{
- //--------------------------------------------------
- // STATIC CONSTANTS
- //--------------------------------------------------
- // Exception text
- /* Optimization: static finals changed to local variables
- private static final String ALPHA_OUT_OF_RANGE_ESTR =
- "The alpha is out of range";
- private static final String INVALID_TARGET_ESTR =
- "The target is invalid";
- private static final String MODE_INVALID_ESTR =
- "The mode is invalid";
- private static final String NULL_IMAGE_ESTR =
- "The image is null";
- private static final String NULL_TARGET_ESTR =
- "The target is null";
- private static final String TARGET_ALREADY_BOUND_ESTR =
- "Target is already bound";
- private static final String TARGET_NOT_BOUND_ESTR =
- "Target is not bound";
- */
- // Transparency alpha max and min limits
- private static final float MAX_TRANSPARENCY_ALPHA = 1.0f;
- private static final float MIN_TRANSPARENCY_ALPHA = 0.0f;
-
- //--------------------------------------------------
- // VARIABLES
- //--------------------------------------------------
- private GC iTargetGC = null;
- private int iUseNativeClear = 0;
- private Graphics iTargetGraphics;
-
- int iSurfaceHandle;
-
- //--------------------------------------------------
- // METHODS
- //--------------------------------------------------
- /**
- * Constructor
- */
- public M2GScalableGraphics()
- {
- super();
- System.out.println("P-Constructor M2GScalableGraphics() called");
- doConstruct();
- }
- /**
- * @see javax.microedition.m2g.ScalableGraphics#bindTarget()
- */
- public synchronized void bindTarget(Object target)
- {
- System.out.println("P-Bind Target called");
- if (target instanceof org.eclipse.swt.graphics.GC)
- {
- final Object finalTarget = target;
- // Execute in UI thread
- Platform.executeInUIThread(
- new M2GRunnableQt() {
- public void doRun() {
- System.out.println("P-Bind Target Thread called");
- // Get GCData from GC
- GCData gcData = ((org.eclipse.swt.graphics.GC)finalTarget).getGCData();
- System.out.println("P-Bind GCData Create");
- // Get internalGC (Graphicscontext), WindowSurface and the WindowSurface handle for native access
- iSurfaceHandle = gcData.internalGc.getWindowSurface().getHandle();
- System.out.println("P-Bind isurfacehandle Created " );
- _bind(getHandle(), iSurfaceHandle);
- }
- });
- // currentTarget = target;
- //We are mentaining seperate current Target as iTargetGC and iTargetGraphics
- iTargetGC = (GC)finalTarget;
- // Handling for LCDUI Graphics
- //
- }
-//Change accordingly to M3G not as site content.
- else if (target instanceof javax.microedition.lcdui.Graphics)
- {
- Graphics g = (Graphics)target;
-
- final Graphics finalG = g;
-
- // Execute in UI thread
- Platform.executeInUIThread(
- new M2GRunnableQt() {
- public void doRun() {
- System.out.println("P-Bind Graphics Case" );
- LCDUIInvoker.startExternalRendering( finalG );
- System.out.println("P-Bind Invoker External rengdering Set Case" );
- iSurfaceHandle = LCDUIInvoker.getWindowSurface(finalG).getHandle();
- System.out.println("P-Bind Invoker External rengdering Set Bind called. Case" );
- _bind(getHandle(), iSurfaceHandle);
-
- }
- });
-
- iTargetGraphics = (Graphics)finalG;
- }
-
- else {
- throw new IllegalArgumentException();
- }
-
- }
-
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
- /**
- * @see com.nokia.microedition.m2g.M2GObject#doConstruct()
- */
- public void doConstruct()
- {
- super.doConstruct();
- // Execute in UI thread
- Platform.executeInUIThread(
- new M2GRunnableQt() {
- public void doRun() {
- setHandle(_createRenderContext(
- getNativeSVGProxyHandle() ));
- // Add object to the live objects container
- }
- });
- register(this);
- }
-
- /**
- * @see com.nokia.microedition.m2g.M2GObject#doCleanup()
- */
- public synchronized void doCleanup()
- {
-
- // Execute in UI thread
- Platform.executeInUIThread(
- new M2GRunnableQt() {
- public void doRun() {
- _deleteRenderContext(
- getHandle() );
- }
- }
- );
- resetHandles();
- iTargetGC = null;
- iTargetGraphics = null;
- }
-
- /**
- * @see javax.microedition.m2g.ScalableGraphics#releaseTarget()
- */
- public synchronized void releaseTarget()
- {
- System.out.println("P-In Release Target" );
- if (iTargetGC != null)
- {
- System.out.println("P-In Release Target graphics.GC" );
- Platform.executeInUIThread(
- new M2GRunnableQt() {
- public void doRun() {
- _release(iSurfaceHandle, getHandle());
- }
- });
- iTargetGC = null;
- }
- else if (iTargetGraphics != null )
- {
-
- System.out.println("P-In Release Target M2GScalableGraphics.. everything is fine... thread complete...." );
- final Graphics finalG = iTargetGraphics;
- Platform.executeInUIThread(
- new M2GRunnableQt() {
- public void doRun() {
- _release(iSurfaceHandle, getHandle());
- LCDUIInvoker.endExternalRendering( finalG );
- }
- });
- System.out.println("P-In Release Target Thread Completed..." );
- iTargetGraphics = null;
- }
- else
- {
- System.out.println("P-In Release Target else case.." );
- // check for invalid Graphics TODO this exception is getting trough when we trying to bind.s
-
- // throw new IllegalStateException(/*SF*/"Target is not bound"/*SF*/);
- }
-
- }
- public synchronized void render(
- int x, int y, ScalableImage image, boolean aUseNativeClear)
- {
- System.out.println("P-In Render M2GScalableGraphics.. erender(int x, int y, ScalableImage image, boolean aUseNativeClear)" );
-
- iUseNativeClear = aUseNativeClear ? 1 : 0;
- render(x, y, image);
- iUseNativeClear = 0;
-
- System.out.println("P-Out Render M2GScalableGraphics.. erender(int x, int y, ScalableImage image, boolean aUseNativeClear)" );
-
- }
-
- /**
- * @see javax.microedition.m2g.ScalableGraphics#render()
- */
- public synchronized void render(int x, int y, ScalableImage image)
- {
- System.out.println("P-In Render M2GScalableGraphics.." );
- if (image == null)
- {
- Logger.ELOG(Logger.EJavaUI, "render() - exception: "
- + /*SF*/"The target is null"/*SF*/);
- throw new NullPointerException(/*SF*/"The target is null"/*SF*/);
- }
- if (iTargetGC != null)
- {
- final M2GDocument finalDoc = (M2GDocument)((SVGImage)image).getDocument();
- // Get synchronized svg image data
- final int finalSvgW = image.getViewportWidth();
- final int finalSvgH = image.getViewportHeight();
- if ((finalSvgW == 0) || (finalSvgW == 0))
- {
- return;
- }
- // Calculate clip dimensions
- Rectangle clipRect = iTargetGC.getClipping();
- final int finalClipX = clipRect.x;
- final int finalClipY = clipRect.y;
- final int finalClipW = clipRect.width;
- final int finalClipH = clipRect.height;
-
- // if none of the svg image is visible due to clipping then don't
- // bother to call render
- if ((x >= (finalClipX + finalClipW)) || (y >= (finalClipY + finalClipH)))
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "render() - svg image isn't visible due to clipping");
- return;
- }
- if (((x + finalSvgW) < finalClipX) || ((y + finalSvgW) < finalClipY))
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "render() - svg image isn't visible due to clipping");
- return;
- }
-
-
- final int finalX = x;
- final int finalY = y;
-
- // Execute in UI thread
- Platform.executeInUIThread(
- new M2GRunnableQt() {
- public void doRun() {
- final int[] finalData = _renderESWT(getHandle(),
- finalDoc.getHandle(), finalX, finalY,
- finalClipX, finalClipY, finalClipW, finalClipH, finalSvgW, finalSvgW,
- finalDoc.getRootElement().getCurrentTime(),
- iUseNativeClear);
-
- int[] bitmapHandles;
- bitmapHandles = new int[4];
- for (int i = 0; i < 4; i++)
- {
- bitmapHandles[i] = finalData[i];
- }
- int[] renderData;
- renderData = new int[6];
- for (int i = 0; i < 6; i++)
- {
- renderData[i] = finalData[i+4];
- }
- //iTargetGC.internal_drawM2GImage(bitmapHandles, renderData, iUseNativeClear);
-
- }});
-
- }//if(true)
- else if (iTargetGraphics != null)
- {
-
- System.out.println("P-In Render M2GScalableGraphics.. else case..." );
- final M2GDocument finalDoc = (M2GDocument)((SVGImage)image).getDocument();
- // Get synchronized svg image data
- final int finalSvgW = image.getViewportWidth();
- final int finalSvgH = image.getViewportHeight();
- if ((finalSvgW == 0) || (finalSvgH == 0))
- {
- return;
- }
- // Calculate clip dimensions
- final int finalClipX = iTargetGraphics.getClipX() + iTargetGraphics.getTranslateX();
- final int finalClipY = iTargetGraphics.getClipY() + iTargetGraphics.getTranslateY();
- final int finalClipW = iTargetGraphics.getClipWidth();
- final int finalClipH = iTargetGraphics.getClipHeight();
- // if none of the svg image is visible due to clipping then don't
- // bother to call render
- if ((x >= (finalClipX + finalClipW)) || (y >= (finalClipY + finalClipH)))
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "render() - svg image isn't visible due to clipping");
- return;
- }
- if (((x + finalSvgW) < finalClipX) || ((y + finalSvgH) < finalClipY))
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "render() - svg image isn't visible due to clipping");
- return;
- }
-
- final int finalX = x;
- final int finalY = y;
-
- System.out.println("P-In Render M2GScalableGraphics.. everything is fine... going in thread.." );
-
- // Execute in UI thread
- Platform.executeInUIThread(
- new M2GRunnableQt() {
- public void doRun() {
- _renderLCDUI(getHandle(), finalDoc.getHandle(), finalX, finalY,
- finalClipX, finalClipY, finalClipW, finalClipH, finalSvgW, finalSvgH,
- finalDoc.getRootElement().getCurrentTime());
- }});
-
- System.out.println("P-In Render M2GScalableGraphics.. everything is fine... thread complete...." );
- }
-
- else
- {
- Logger.ELOG(Logger.EJavaUI, "render() - exception: "
- + /*SF*/"Target is not bound"/*SF*/);//TODO for time being commented.s
- //throw new IllegalStateException(/*SF*/"Target is not bound"/*SF*/);
- }
- System.out.println("P-In Render M2GScalableGraphics.. Render Completed.." );
- }
-
- /**
- * @see javax.microedition.m2g.ScalableGraphics#setRenderingQuality(int)
- */
- public synchronized void setRenderingQuality(int mode)
- {
- if ((mode == ScalableGraphics.RENDERING_QUALITY_LOW) ||
- (mode == ScalableGraphics.RENDERING_QUALITY_HIGH))
- {
- final int finalMode = mode;
- // Execute in UI thread
- Platform.executeInUIThread(
- new M2GRunnableQt() {
- public void doRun() {
- _setRenderingQuality(getHandle(), finalMode);
- }
- });
- }
- else
- {
- Logger.ELOG(Logger.EJavaUI,
- "setRenderingQuality() - exception: " + /*SF*/"The mode is invalid"/*SF*/);
- throw new IllegalArgumentException(/*SF*/"The mode is invalid"/*SF*/);
- }
- }
-
- /**
- * @see javax.microedition.m2g.ScalableGraphics#setTransparency(float)
- */
- public synchronized void setTransparency(float alpha)
- {
- if (alpha >= MIN_TRANSPARENCY_ALPHA && alpha <= MAX_TRANSPARENCY_ALPHA)
- {
- final float finalAlpha = alpha;
- // Execute in UI thread
- Platform.executeInUIThread(
- new M2GRunnableQt() {
- public void doRun() {
- _setTransparency(getHandle(), finalAlpha);
- }
- }
- );
- }
- else
- {
- Logger.ELOG(Logger.EJavaUI,
- "setTransparency() - exception: " + /*SF*/"The alpha is out of range"/*SF*/);
- throw new IllegalArgumentException(/*SF*/"The alpha is out of range"/*SF*/);
- }
- }
-
-
- //--------------------------------------------------
- // NATIVE METHODS
- //--------------------------------------------------
- private native int _bind(
- int aRenderContextHandle, int aTargetHandle);
- private native int _createRenderContext(
- int aSVGProxyHandle);
- private native void _deleteRenderContext(
- int aRenderContextHandle);
- private native int _release(
- int aSurfaceHandle ,int aRenderContextHandle);
- private native int _renderLCDUI(
- int aRenderContextHandle, int aDocumentHandle,
- int aX, int aY, int aClipX, int aClipY, int aClipW, int aClipH,
- int aSvgW, int aSvgH, float aCurrentTime);
- private native int[] _renderESWT(
- int aRenderContextHandle, int aDocumentHandle,
- int aX, int aY, int aClipX, int aClipY, int aClipW, int aClipH,
- int aSvgW, int aSvgH, float aCurrentTime, int iUseNativeClear);
- private native void _setRenderingQuality(
- int aRenderContextHandle, int aMode);
- private native void _setTransparency(
- int aRenderContextHandle, float aAlpha);
-}
--- a/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/NativeError.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,256 +0,0 @@
-/*
-* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Native Error Descriptions for M2G Component.
-*
-*/
-
-
-package com.nokia.microedition.m2g;
-
-import java.io.IOException;
-
-/**
- * A utility class for declaring and handling native SymbianOS error codes.
- * All error codes that are used in Java from native code should be
- * declared here and referenced from this class. Also if a new error code
- * is added, it should be added to the list of compile-time asserts in
- * NativeError.cpp.
- */
-public final class NativeError
-{
- public static final String NATIVE_ERROR_MESSAGE = "SymbianOS error = ";
- private static final int BUFFER_SIZE = 256;
-
- // SymbianOS error codes
- public static final int KErrNone = 0;
- public static final int KErrNotFound = -1;
- public static final int KErrGeneral = -2;
- public static final int KErrCancel = -3;
- public static final int KErrNoMemory = -4;
- public static final int KErrNotSupported = -5;
- public static final int KErrArgument = -6;
- public static final int KErrOverflow = -9;
- public static final int KErrAlreadyExists = -11;
- public static final int KErrPathNotFound = -12;
- public static final int KErrDied = -13;
- public static final int KErrNotReady = -18;
- public static final int KErrCorrupt = -20;
- public static final int KErrAccessDenied = -21;
- public static final int KErrWrite = -23;
- public static final int KErrEof = -25;
- public static final int KErrDiskFull = -26;
- public static final int KErrBadName = -28;
- public static final int KErrCommsLineFail = -29;
- public static final int KErrTimedOut = -33;
- public static final int KErrDisconnected = -36;
- public static final int KErrTooBig = -40;
- public static final int KErrDivideByZero = -41;
- public static final int KErrHardwareNotAvailable = -44;
-
-
- // Not intended to be constructed
- private NativeError()
- {
- }
-
-
-
- /**
- * Checks for basic native error codes that map to standard Java
- * exceptions and throws the exception if the error code matches.
- * Otherwise just returns the error.
- *
- * @param aError Possible error code.
- * @return Value passed in is returned if not an error.
- * @throws OutOfMemoryError If aError equals KErrNoMemory.
- * @throws IllegalArgumentException If aError equals KErrArgument
- * @throws ArithmeticException If aError equals KErrDivideByZero
- */
- public static int checkExplicitOnly(int aError)
- {
- if (aError < KErrNone)
- {
- switch (aError)
- {
- case KErrNoMemory:
- throw new OutOfMemoryError();
- // KErrArgument must throw IllegalArgumentException
- // otherwise lcdui will break, so don't change this.
- case KErrArgument:
- throw new IllegalArgumentException();
- case KErrDivideByZero:
- throw new ArithmeticException();
- default:
- // Do nothing
- }
- }
- return aError;
- }
-
-
-
- /**
- * Checks for basic native error codes that map to standard Java
- * exceptions and throws the exception if the error code matches.
- * Otherwise throws basic Error class.
- *
- * @param aError Possible error code.
- * @param aThrowAlways Determines whether a default exception is thrown
- * if the error code is not recognised.
- * @return Value passed in is returned if not an error.
- * @throws Error If the error code does not match any exception thrown
- * in checkExplicitOnly, a default exception is thrown here.
- */
- public static int check(int aError)
- {
- if (aError < KErrNone)
- {
- checkExplicitOnly(aError);
- throw new Error(errorMessage(aError));
- }
- return aError;
- }
-
-
-
- /**
- * Version of check that uses a long rather than an int.
- */
- public static long check(long aError)
- {
- check((int)aError);
- return aError;
- }
-
-
-
- /**
- * Checks for basic native error codes that map to standard Java
- * exceptions and throws the exception if the error code matches.
- * Otherwise throws an IOException.
- *
- * @param aError Possible error code.
- * @return Value passed in is returned if not an error.
- */
- public static int checkIO(int aError)
- throws IOException
- {
- if (aError < KErrNone)
- {
- checkExplicitOnly(aError);
- throw new IOException(errorMessage(aError));
- }
- return aError;
- }
-
-
-
- /**
- * Checks if the error code represents out of memory, and throws Java Error
- * if true. Otherwise throws basic Error class.
- *
- * @param aError Possible error code.
- * @return Value passed in is returned if not an error.
- */
- public static int checkOOM(int aError)
- {
- if (aError < KErrNone)
- {
- if (aError == KErrNoMemory)
- {
- throw new OutOfMemoryError();
- }
- throw new Error(errorMessage(aError));
- }
- return aError;
- }
-
-
-
- /**
- * Checks if the object is a null reference, and throws OutOfMemoryError
- * if this is the case. Useful for checking for OOM when Java objects
- * returned from a native method.
- *
- * @param aObject Object that may be null.
- * @return Value passed in is returned if not an error.
- */
- public static Object checkOOM(Object aObject)
- {
- if (aObject == null)
- {
- throw new OutOfMemoryError();
- }
- return aObject;
- }
-
-
-
- /**
- * Checks if the error code represents out of memory, and throws Java Error
- * if true. Does not throw anything otherwise.
- *
- * @param aError Possible error code.
- * @return Value passed in is returned if not an out of memory error.
- */
- public static int checkOOMOnly(int aError)
- {
- if (aError == KErrNoMemory)
- {
- throw new OutOfMemoryError();
- }
- return aError;
- }
-
-
-
- /**
- * Returns a string formatted with generic text to indicate where the error
- * code comes from and the error code given.
- *
- * @param A native error code.
- * @return A string containing the error code and explanatory text.
- */
- public static String errorMessage(int aError)
- {
- final String message = _getNativeErrorMessage(aError);
- String result = NATIVE_ERROR_MESSAGE.concat(Integer.toString(aError));
- if (message != null && message.length() > 0)
- result = result.concat(" : ").concat(message);
- return result;
- }
-
- /**
- * Returns a string formatted with generic text to indicate where the error
- * code comes from and the error code given.
- *
- * @param A native error code.
- * @param An extra text message for more information.
- * @return A string containing the error code and explanatory text.
- */
- public static String errorMessage(int aError, String aExtraText)
- {
- final StringBuffer messageBuf = new StringBuffer(BUFFER_SIZE); // use native max as base
- messageBuf.append(aExtraText);
- messageBuf.append(", ");
- messageBuf.append(errorMessage(aError));
- return messageBuf.toString();
- }
-
-
- private static native String _getNativeErrorMessage(int aError);
-
-}
-
-
--- a/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/Platform.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,234 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-/**
- * \file
- * \brief Target platform dependent Java module for Symbian.
- *
- */
-
-package com.nokia.microedition.m2g;
-import javax.microedition.lcdui.Graphics;
-import javax.microedition.lcdui.Image;
-import org.eclipse.swt.widgets.Display;
-
-import com.nokia.mj.impl.nokialcdui.LCDUIInvoker;
-import org.eclipse.swt.internal.extension.DisplayExtension;
-
-/**
- * Implements platform-dependent functionality. At the moment, this
- * includes native finalization and some helper methods for
- * synchronizing 2D and 3D rendering.
- */
-class Platform
-{
- /**
- * eSWT display for ui thread access
- */
- private static Display display = null;
- private static boolean libraryLoaded = false;
-
- //------------------------------------------------------------------
- // Package private methods
- //------------------------------------------------------------------
-
- /**
- * Executes given runnable in UI thread if caller thread is not UI thread
- */
- static void executeInUIThread(M2GRunnableQt obj)
- {
- if (display == null)
- {
- if (!uiThreadAvailable())
- {
- throw new Error("Ui thread not available");
- }
- }
- if (display.isDisposed())
- {
- throw new Error("Display already disposed");
- }
-
- if (obj != null)
- {
- // If we are not in UI thread use display
- if (Thread.currentThread() != display.getThread())
- {
- display.syncExec(obj);
- }
- else
- {
- // In this case we are in UI thread so just execute directly
- obj.run();
- }
- // Check if any exceptions occured in execution
- // and throw forward in caller thread
- obj.checkAndThrow();
- }
- }
-
- /**
- * Check the UI thread / toolkit init status and store display if it is available
- * @return true if either lcdui or eswt toolkit is initialized and ui thread is accessible
- * otherwise false
- */
- static boolean uiThreadAvailable()
- {
- if (display != null)
- {
- return true;
- }
- else
- {
- display = DisplayExtension.getDisplayInstance();
- System.out.println("P-UI Thread not available Case" );
- if (display == null)
- {
- return false;
- }
- else
- {
- System.out.println("P-UI Thread available Case" );
- // UI thread is available, so load native library if not already loaded
- if (!libraryLoaded)
- {
- System.out.println("P-UI Thread not available Case Javam2g loaded" );
- com.nokia.mj.impl.rt.support.Jvm.loadSystemLibrary("javam2g");
- libraryLoaded = true;
- }
- return true;
- }
- }
- }
-
- /**
- * Registers an Object3D in the global handle-to-object map. The
- * handle of the object must already be set at this point!
- */
-// static final void registerFinalizer(Object3D obj)
-// {
-// //heuristicGC();
-// }
-//
-// /**
-// * Registers a Graphics3D object (not derived from Object3D) for
-// * finalization.
-// */
-// static final void registerFinalizer(Graphics3D g3d)
-// {
-// //heuristicGC();
-// }
-//
-// /**
-// * Registers an Interface object for finalization
-// */
-// static final void registerFinalizer(Interface m2G)
-// {
-// }
-//
-// /**
-// * Registers a Loader object for finalization
-// */
-// static final void registerFinalizer(Loader loader)
-// {
-// }
-//
-// /**
-// * Flushes all pending rendering to a Graphics context and blocks
-// * until finished
-// */
-// static final void sync(Graphics g)
-// {
-// //ToolkitInvoker invoker = ToolkitInvoker.getToolkitInvoker();
-// //invoker.toolkitSync(invoker.getToolkit());
-// }
-//
-// /**
-// * Flushes all pending rendering to an Image object
-// */
-// static final void sync(Image img)
-// {
-// //ToolkitInvoker invoker = ToolkitInvoker.getToolkitInvoker();
-// //invoker.toolkitSync(invoker.getToolkit());
-// }
-//
-// /**
-// * Finalizes the native peer of an interface
-// */
-// static final native void finalizeInterface(int handle);
-//
-// /**
-// * Finalizes the native peer of an object
-// * JCF: added this wrapper method so we could pass the toolkit handle to the native method.
-// */
- static final void finalizeObject(int handle)
- {
- try
- {
- final int finalHandle = handle;
- executeInUIThread(
- new M2GRunnableQt()
- {
- void doRun()
- {
- _finalizeObject(finalHandle);
- }
- });
- }
- catch (Exception e)
- {
- // do nothing
- }
- }
-
- /**
- * Finalizes the native peer of an object associated with
- * given Interface instance
- */
-// static final void finalizeObject(int handle, Interface aInterface)
-// {
-// try
-// {
-// final int finalHandle = handle;
-// executeInUIThread(
-// new M2GRunnable()
-// {
-// public void doRun()
-// {
-// _finalizeObject(finalHandle);
-// }
-// });
-// }
-// catch (Exception e)
-// {
-// // do nothing
-// }
-// }
-
-
- //------------------------------------------------------------------
- // Private methods
- //------------------------------------------------------------------
-
- /**
- * Trigger GC if minimum free memory limit has been exceeded in the native side
- */
- static final void heuristicGC()
- {
- }
- private static final native void _finalizeObject(int handle);
-}
-
--- a/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/connection/M2GConnectionFactory.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,159 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-package com.nokia.microedition.m2g.connection;
-
-import java.io.IOException;
-import javax.microedition.m2g.ExternalResourceHandler;
-import com.nokia.microedition.m2g.connection.common.M2GConnectionPolicyImpl;
-
-/**
- * Connection factory
- */
-public class M2GConnectionFactory
-{
- //--------------------------------------------------
- // STATIC CONSTANTS
- //--------------------------------------------------
- public static final String COMMON_PROTOCOL =
- "common";
- public static final String FILE_PROTOCOL =
- "file";
- public static final String CONNECTION_BASE_PACKAGE =
- "com.nokia.microedition.m2g.connection.";
- public static final String CONNECTION_PROXY_CLASS_NAME =
- ".M2GConnectionProxyImpl";
-
-
- //--------------------------------------------------
- // METHODS
- //--------------------------------------------------
- /**
- * Ctor
- */
- private M2GConnectionFactory()
- {
- }
-
- /**
- * Create a connection proxy.
- * If a url is not absolute or if it's beginig with
- * the slash mark then a resource is considered to be opened from a jar file.
- * @param aUrl Locator
- * @return Connection proxy
- * @throws IOException if an io error occurs
- * @throws NullPointerException if the locator is null.
- * @throws IllegalArgumentException if the locator is of unsupported type.
- */
- public static M2GConnectionProxy create(String aUrl) throws IOException
- {
- try
- {
- M2GConnectionProxy proxy = null;
- M2GUrlTokenizer tokenizer = new M2GUrlTokenizer(aUrl);
-
- // If a url begins with the slash mark then
- // a resource is tryed to open from a jar file.
- if (!M2GUrlTokenizer.isAbsolutURL(aUrl) ||
- tokenizer.beginWithSlash())
- {
- proxy = new M2GConnectionProxy();
- }
- else
- {
- Class proxyClass =
- Class.forName(parseClassName(tokenizer.getProtocol()));
- proxy = (M2GConnectionProxy)proxyClass.newInstance();
- }
- proxy.open(tokenizer);
- return proxy;
- }
- catch (InstantiationException e)
- {
- throw new IllegalArgumentException("Internal error: " + e.getMessage());
- }
- catch (IllegalAccessException e)
- {
- throw new IllegalArgumentException("Internal error: " + e.getMessage());
- }
- catch (ClassNotFoundException e)
- {
- throw new IllegalArgumentException("Internal error: " + e.getMessage());
- }
- }
-
- /**
- * Get default external resource handler
- * @param aUrl URL
- * @return external resource handler
- */
- public static ExternalResourceHandler getExternalResourceHandler(String aUrl)
- {
- return new M2GDefaultExternalResourceHandler(aUrl);
- }
-
- /**
- * Resolve external resource URL
- * @param aTokenizer Tokenizer
- * @param aUrl URL
- * @return connection proxy
- * @throws IOException
- */
- public static M2GConnectionProxy resolveExternalResourceUrl(
- M2GUrlTokenizer aTokenizer, String aUrl) throws IOException
- {
- // Check if the URL is relative.
- if (!M2GUrlTokenizer.isAbsolutURL(aUrl))
- {
- if (aTokenizer.getBaseUrl() != null)
- {
- aUrl = aTokenizer.resolveUrl(aUrl);
- }
- }
-
- return M2GConnectionFactory.create(aUrl);
- }
-
- /**
- * Get default policy
- * @return Connection policy
- */
- public static M2GConnectionPolicy getDefaultPolicy()
- {
- return new M2GConnectionPolicyImpl();
- }
-
- /**
- * Parses a connection proxy class name.
- * @param aProtocol Protocol
- * @return Connection proxy class name
- */
- private static String parseClassName(String aProtocol)
- {
- if (aProtocol.equals(FILE_PROTOCOL))
- {
- return
- CONNECTION_BASE_PACKAGE + FILE_PROTOCOL + CONNECTION_PROXY_CLASS_NAME;
- }
- else
- {
- return
- CONNECTION_BASE_PACKAGE + COMMON_PROTOCOL + CONNECTION_PROXY_CLASS_NAME;
-
- }
- }
-}
--- a/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/connection/M2GConnectionPolicy.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-package com.nokia.microedition.m2g.connection;
-
-/**
- * Connection policy
- */
-public interface M2GConnectionPolicy
-{
- /**
- * Get access right
- * @return Rights
- */
- public boolean getAccessRight();
-
-}
\ No newline at end of file
--- a/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/connection/M2GConnectionPolicyHandler.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-package com.nokia.microedition.m2g.connection;
-
-/**
- * Interface for connection policy handler
- */
-public interface M2GConnectionPolicyHandler
-{
- /**
- * Get connection policy
- * @return Policy
- */
- public M2GConnectionPolicy getConnectionPolicy();
-
- /**
- * Set connection policy
- * @param aConnectionPolicy Policy
- */
- public void setConnectionPolicy(M2GConnectionPolicy aConnectionPolicy);
-}
--- a/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/connection/M2GConnectionProxy.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,150 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-package com.nokia.microedition.m2g.connection;
-
-import java.io.IOException;
-import java.io.InputStream;
-import javax.microedition.io.StreamConnection;
-import com.nokia.mj.impl.utils.Logger;
-
-
-/**
- * Base connection proxy class
- */
-public class M2GConnectionProxy
-{
- //--------------------------------------------------
- // STATIC CONSTANTS
- //--------------------------------------------------
- // Error constants
- static final String RESOURCE_NOT_FOUND_ESTR =
- "Given resource is not found.";
-
- //--------------------------------------------------
- // VARIABLES
- //--------------------------------------------------
- protected String iBaseUrl = null;
- protected String iSuffixUrl = null;
- protected InputStream iInputStream = null;
- protected StreamConnection iConnection = null;
- protected M2GConnectionPolicy iConnectionPolicy = null;
-
- //--------------------------------------------------
- // METHODS
- //--------------------------------------------------
-
- /**
- * Ctor.
- */
- public M2GConnectionProxy()
- {
- }
-
-
- /**
- * Close the connection.
- * When a connection has been closed, access to any of its
- * methods that involve an I/O operation will cause an
- * IOException to be thrown.
- * Closing an already closed connection has no effect.
- */
- public void close() throws IOException
- {
- if (iInputStream != null)
- {
- iInputStream.close();
- iInputStream = null;
- }
- if (iConnection != null)
- {
- iConnection.close();
- iConnection = null;
- }
- iConnectionPolicy = null;
- }
-
- /**
- * Get base url
- * @return Base url
- */
- public String getBaseUrl()
- {
- return iBaseUrl;
- }
-
- /**
- * Get the suffix url
- * @note The suffix is calculated in m2g.connection.file.M2GConnectionProxyImpl.open()
- * @return Suffix url including '?' if there is a suffix, and null otherwise
- */
- public String getSuffixUrl()
- {
- return iSuffixUrl;
- }
-
- /**
- * Get an input stream for a connection.
- * @return An input stream
- * @throws IOException If the input stream is null.
- */
- public InputStream getInputStream() throws IOException
- {
- if (iInputStream == null)
- {
- throw new IOException();
- }
- return iInputStream;
- }
-
- /**
- * Get a connection policy.
- * @return A connection policy
- * @throws IOException If the connection policy is null.
- */
- public M2GConnectionPolicy getConnectionPolicy() throws IOException
- {
- if (iConnectionPolicy == null)
- {
- throw new IOException();
- }
- return iConnectionPolicy;
- }
-
-
- /**
- * Open a connection to a file located in a jar file..
- * @param aTokenizer Url tokenizer
- * @throws IOException If an error occurs while loading a content.
- * @throws IllegalArgumentException If no resource is found according to an URL.
- */
- public void open(M2GUrlTokenizer aTokenizer) throws IOException
- {
- iBaseUrl = aTokenizer.getBaseUrl();
- iSuffixUrl = null; // can't have DRM mode within a JAR
-
- iInputStream =
- Runtime.getRuntime().getClass().getResourceAsStream(aTokenizer.getUrl());
-
- if (iInputStream == null)
- {
- Logger.ELOG(Logger.EJavaUI, RESOURCE_NOT_FOUND_ESTR);
- throw new IllegalArgumentException(RESOURCE_NOT_FOUND_ESTR);
- }
- iConnectionPolicy = M2GConnectionFactory.getDefaultPolicy();
- }
-}
--- a/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/connection/M2GDefaultExternalResourceHandler.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,157 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-package com.nokia.microedition.m2g.connection;
-
-
-import java.io.*;
-import javax.microedition.io.*;
-import javax.microedition.m2g.ExternalResourceHandler;
-import javax.microedition.m2g.*;
-
-
-/**
-* <p>This private class is the default resource handler
-* used to load external resources that are referenced
-* within a ScalableImage, namely within a SVG document in the case of SVG.
-* The default resource handler will be used by the platform in the following cases:
-* - if the MIDlet has not explicitly set its own handler to load external resources
-* - if the resource handler specified by the MIDlet is not able to load the
-* external resources (i.e. the MIDlet's SVGResourceHandle.getExternalResource()
-* returns null).</p>
-* @see javax.microedition.m2g.ExternalResourceHandler
-*/
-public class M2GDefaultExternalResourceHandler implements ExternalResourceHandler
-{
-
- /*
- * According to RFC 2396, the rules for determening the base URI can be summarized
- * as follows (highest priority to lowest):
- * 1.The base URI is embedded in the document's content.
- * 2.The base URI is that of the encapsulating document.
- * 3.The base URI is the URI used to retrieve the entity.
- * 4.The base URI is defined by the context of the application
- *
- * Note that in the case of the M2GDefaultExternalResourceHandler 4. is not
- * applicable.
- */
-
- //--------------------------------------------------
- // VARIABLES
- //--------------------------------------------------
- private M2GUrlTokenizer iTokenizer = null;
-
- //--------------------------------------------------
- // METHODS
- //--------------------------------------------------
- /**
- * This constructor is used to create a default resource handler that can
- * load resources from absolute URLs and from URLs that are relative
- * to the aUrl.
- * NOTE: This handler will not be allowed to load resources from the application's
- * jar file.
- *
- * @param aUrl The already validated url used to load the svg document
- */
- M2GDefaultExternalResourceHandler(String aUrl)
- {
- if (aUrl == null || aUrl.equals(""))
- {
- iTokenizer = new M2GUrlTokenizer();
- }
- else
- {
- iTokenizer = new M2GUrlTokenizer(aUrl);
- }
- }
-
- /**
- * This constructor is used to create a default resource handler that can
- * load external resources from fully qualified URLs ONLY. Any relative URL
- * will be considered to be a link to a resource within the application's jar file.
- */
- M2GDefaultExternalResourceHandler()
- {
- this(null);
- }
-
- /**
- * This method is invoked when an external resource is required by the underlying implementation.
- * When the request is completed by the implementation of this handler, a notification
- * must be sent to the SVG engine through the requestCompleted() method of <code>ScalableImage</code>.
- * To get a synchronous behaviour, requestCompleted() can be called in the implementation
- * of requestResource. If called later, rendering the document before
- * completing all the requests will just display the currently available content.
- * Once the request is completed, the image will have to be redrawn to reflect the newly
- * available data.
- * For more details on required resources, please refer to the <code>externalResourcesRequired</code>
- * attribute description in the SVG specification.
- *
- * @param image image that originated the external data request
- * @param URL the an absolute or a relative URL for the external resource + drm mode
- */
- public void requestResource(ScalableImage aImage, String aUrl)
- {
- M2GConnectionProxy proxy = null;
-
- /* IMPLEMENTATION NOTE:
- * The default resource handler assumes that if there is an embedded base URL within the
- * document then is upon the svg engine to provide the absolute URL.
- * If the given URL is a relative URL then this handler will attempt to use as a base URL
- * to retrieve the containing svg document. However, if the document's base
- * URL is null then this handler will assume the given relative URL to be a file name
- * within the application's jar file.
- */
- try
- {
- // NOTE: if exception is thrown during the resolveExternalResourceUrl() call then
- // the requestCompleted should be called again with a null input stream.
- proxy = M2GConnectionFactory.resolveExternalResourceUrl(iTokenizer, aUrl);
- aImage.requestCompleted(aUrl, proxy.getInputStream());
- }
- catch (Exception e)
- {
- // e.printStackTrace();
- // The requestCompleted() failed
- try
- {
- aImage.requestCompleted(aUrl, null);
- }
- catch (Exception ee)
- {
- // ee.printStackTrace();
- }
- }
- // Close streams
- finally
- {
- try
- {
- if (proxy != null)
- {
- proxy.close();
- }
- }
- catch (Exception e)
- {
- // e.printStackTrace();
- }
- }
- }
-}
-
-
--- a/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/connection/M2GUrlTokenizer.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,280 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-package com.nokia.microedition.m2g.connection;
-
-import java.io.IOException;
-import java.lang.NullPointerException;
-import java.lang.IllegalArgumentException;
-import com.nokia.mj.impl.utils.Logger;
-
-/**
- * Connection policy
- */
-public class M2GUrlTokenizer
-{
- //--------------------------------------------------
- // STATIC CONSTANTS
- //--------------------------------------------------
- public static final String PROTOCOL_SEPARATOR =
- "://";
- public static final char PARAMETER_SEPARATOR =
- '?';
- public static final char SEPARATOR =
- '/';
-
- //--------------------------------------------------
- // VARIABLES
- //--------------------------------------------------
- private String iUrl = null;
- private String iBaseUrl = null;
-
- //--------------------------------------------------
- // METHODS
- //--------------------------------------------------
- /**
- * Ctor
- */
- public M2GUrlTokenizer()
- {
- }
-
- /**
- * Ctor
- * @param aUrl Locator
- * @throws NullPointerException if the locator is null.
- * @throws IllegalArgumentException if the locator is of unsupported type.
- */
- public M2GUrlTokenizer(String aUrl)
- {
- setUrl(aUrl);
- }
-
- /**
- * Check if the url begin with slash ('/')
- * @return true is the url begin with slash
- */
- public boolean beginWithSlash()
- {
- if ((iUrl != null) &&
- (iUrl.indexOf(SEPARATOR) == 0))
- {
- return true;
- }
- return false;
- }
-
-
- /**
- * Parses the base part of the locator
- * @return parsed base part
- */
- public String getBasePart()
- {
- if (iUrl == null)
- {
- return null;
- }
- int pos = iUrl.indexOf(PARAMETER_SEPARATOR);
- if (pos == -1)
- {
- pos = iUrl.length();
- }
- return iUrl.substring(0, pos);
- }
-
- /**
- * Parses the base url
- * @return parsed base url
- */
- public String getBaseUrl()
- {
- return iBaseUrl;
- }
-
- /**
- * Parses the end part of the locator
- * @return parsed end part
- * @throws IllegalArgumentException if base part cannot
- * be parsed from the locator
- */
- public String getEndPart()
- {
- if (iUrl == null)
- {
- return null;
- }
- int pos = iUrl.lastIndexOf(SEPARATOR);
- if (pos == -1)
- {
- return iUrl;
- }
- return iUrl.substring(pos, iUrl.length());
- }
-
- /**
- * Parses the middle part of the locator
- * @return parsed middle part
- * @throws IllegalArgumentException if middle part cannot
- * be parsed from the locator
- */
- public String getMiddlePart()
- {
- if (iUrl == null)
- {
- return null;
- }
- int pos = iUrl.indexOf(PARAMETER_SEPARATOR);
- if (pos == -1)
- {
- pos = iUrl.length();
- }
- return iUrl.substring(
- getProtocol().length() + PROTOCOL_SEPARATOR.length(), pos);
- }
-
- /**
- * Parses possible parameters of the locator
- * @return Parsed parameters or null if there are not parameters
- */
- public String getParameters()
- {
- if (iUrl == null)
- {
- return null;
- }
- int pos = iUrl.indexOf(PARAMETER_SEPARATOR);
- String parameters = null;
- if (pos != -1)
- {
- parameters = iUrl.substring(pos + 1);
- }
- return parameters;
- }
-
- /**
- * Parses the protocol part of the locator.
- * @see M2GUrlTokenizer#isAbsolutURL()
- * @return Protocol
- * @throws IllegalArgumentException If the locator is of
- * unsupported type.
- */
- public String getProtocol()
- {
- int pos = -1;
- if ((iUrl == null) || ((pos = iUrl.indexOf(PROTOCOL_SEPARATOR)) == -1))
- {
- throw new IllegalArgumentException("Unable to parse protocol");
- }
- return iUrl.substring(0, pos);
- }
-
- /**
- * Returns a whole locator string
- * @return Locator used to create this instance
- */
- public String getUrl()
- {
- return iUrl;
- }
-
- /**
- * Resolve URL according to existing base url and
- * the given relative url
- * TODO: Should be resolved by using RFC 2396
- * @aRelativeUrl Relative URL.
- * @return Resolved URL
- */
- public String resolveUrl(String aRelativeUrl)
- {
- check(aRelativeUrl);
- if (iBaseUrl != null)
- {
- return (iBaseUrl + aRelativeUrl);
- }
- else
- {
- return aRelativeUrl;
- }
- }
-
-
- /**
- * Set a locator string
- * @param aUrl Locator
- * @throws NullPointerException if the locator is null.
- * @throws IllegalArgumentException if the locator is of unsupported type.
- */
- public void setUrl(String aUrl)
- {
- check(aUrl);
- iUrl = aUrl;
- int pos = iUrl.lastIndexOf(SEPARATOR);
- if (pos == -1)
- {
- iBaseUrl = null;
- }
- else
- {
- iBaseUrl = iUrl.substring(0, (pos + 1));
- }
- }
-
- /**
- * Check url
- * @param aUrl Locator
- * @throws NullPointerException if the locator is null.
- * @throws IllegalArgumentException if the locator is of unsupported type.
- */
- private void check(String aUrl)
- {
- if (aUrl == null)
- {
- Logger.ELOG(Logger.EJavaUI, "setUrl() - url is null");
- throw new NullPointerException();
- }
- if (aUrl.length() == 0)
- {
- Logger.ELOG(Logger.EJavaUI, "setUrl() - url is illegal");
- throw new IllegalArgumentException();
- }
- }
-
- //--------------------------------------------------
- // STATIC METHODS
- //--------------------------------------------------
- /**
- * Check if contains protocol.
- * An absolute URL contains the name of the scheme being used (<scheme>)
- * followed by a colon (":") and then a string (the <scheme-specific-
- * // part>) whose interpretation depends on the scheme.
- * Also if the URL begins with a slash character "/" then the URL is treated
- * as absolute.
- * @param aUrl URL
- * @return true if URL contains a protocol
- */
- static public boolean isAbsolutURL(String aUrl)
- {
- if ((aUrl == null) ||
- ((aUrl.indexOf(PROTOCOL_SEPARATOR) == -1) &&
- (aUrl.indexOf(SEPARATOR) != 0)))
- {
- return false;
- }
- return true;
- }
-}
--- a/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/connection/common/M2GConnectionPolicyImpl.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-package com.nokia.microedition.m2g.connection.common;
-
-import com.nokia.microedition.m2g.connection.M2GConnectionPolicy;
-
-/**
- * Connection policy
- */
-public class M2GConnectionPolicyImpl implements M2GConnectionPolicy
-{
- //--------------------------------------------------
- // METHODS
- //--------------------------------------------------
- /**
- * Ctor
- */
- public M2GConnectionPolicyImpl()
- {
- }
-
- /**
- * Get access rights
- * @see M2GConnectionPolicy#getAccessRight()
- */
- public boolean getAccessRight()
- {
- return true;
- }
-
-}
--- a/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/connection/common/M2GConnectionProxyImpl.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-package com.nokia.microedition.m2g.connection.common;
-
-import javax.microedition.io.Connector;
-import javax.microedition.io.StreamConnection;
-import javax.microedition.io.ConnectionNotFoundException;
-import java.io.IOException;
-import java.lang.IllegalArgumentException;
-import com.nokia.microedition.m2g.connection.*;
-
-/**
- * Connection proxy class
- */
-public class M2GConnectionProxyImpl extends M2GConnectionProxy
-
-{
- //--------------------------------------------------
- // METHODS
- //--------------------------------------------------
- /**
- * Ctor.
- */
- public M2GConnectionProxyImpl()
- {
- }
-
- /**
- * Open a connection.
- * @see M2GConnectionProxy#open()
- */
- public void open(M2GUrlTokenizer aTokenizer) throws IOException
- {
- iBaseUrl = aTokenizer.getBaseUrl();
- iSuffixUrl = null; // can't have DRM suffix when opening from stream
- iConnectionPolicy = new M2GConnectionPolicyImpl();
- try
- {
- iConnection = (StreamConnection)Connector.open(
- aTokenizer.getUrl());
- iInputStream = iConnection.openInputStream();
- }
- catch (ConnectionNotFoundException e)
- {
- throw new IllegalArgumentException(e.getMessage());
- }
- }
-}
--- a/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/connection/file/M2GConnectionPolicyImpl.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,302 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-package com.nokia.microedition.m2g.connection.file;
-
-import java.io.IOException;
-import java.lang.NullPointerException;
-import java.lang.IllegalArgumentException;
-import java.lang.SecurityException;
-import com.nokia.microedition.m2g.connection.*;
-import com.nokia.microedition.m2g.M2GSVGConstants;
-import com.nokia.mj.impl.utils.Logger;
-
-/**
- * Connection policy
- * <b>DRM - DECRYPTED MODE</b>
- * <p>
- * <b>Description</b>
- * <br>
- * When a MIDlet tries to open a file using a URL that starts with file:// and
- * ends either with ?drm=dec+display or with ?drm=dec+display+preview,
- * this is interpreted as a request to open the file for reading of the
- * content in the plaintext form.
- * Example URLs:
- * file:///E:/foo.svg?drm=dec+display
- * file:///E:/foo.svg?drm=dec+display+preview
- * <br>
- * Supported only if the midlet belongs to MANUFACTURER DOMAIN otherwise
- * java.lang.SecurityException is thrown.
- * </p>
- * <br>
- * <br>
- * <b>DRM - ENCRYPTED MODE</b>
- * <p>
- * <b>Description</b>
- * <br>
- * When a MIDlet tries to open a file using a URL that starts with file:// and
- * ends with ?drm=enc, this is interpreted as a request to open the
- * file for reading of the content in the encrypted form.
- * Example URLs:
- * file:///E:/foo.svg?drm=enc
- * <br>
- * Not supported, java.lang.IllegalArgumentException is thrown always.
- * </p>
- * <br>
- * <br>
- * <b>DRM - DEFAULT MODE</b>
- * <p>
- * <b>Description</b>
- * <br>
- * When a MIDlet tries to open a file using either a normal file URL or a
- * file URL that ends with ?drm=preview, this is interpreted as a request to open the
- * file for reading of the content in the decrypted form.
- * NOTE: Preview mechanism is not available to MIDlets that don't
- * belong to MANUFACTURER DOMAIN.
- * Example URLs:
- * file:///E:/foo.svg
- * file:///E:/foo.svg?drm=preview
- * <br>
- * Access to SVG document via DOM API is NOT allowed, i.e. only rendering of the
- * content is allowed if a MIDlet uses a default mode URL.
- * If it's tryed to access to SVG document via DOM API then
- * java.lang.SecurityException is thrown.
- * </p>
- */
-public class M2GConnectionPolicyImpl implements M2GConnectionPolicy
-{
- //--------------------------------------------------
- // STATIC CONSTANTS
- //--------------------------------------------------
- public static final String ENC_NOT_SUPPORTED_ESTR =
- "A URL with an encrypted mode is not supported.";
- public static final String DRM_PARAMETER =
- "drm";
- public static final String DECRYPTED_MODE =
- "dec";
- public static final String ENCRYPTED_MODE =
- "enc";
- public static final String DEFAULT_MODE =
- "def";
- public static final String DEFAULT_PREVIEW_MODE =
- "def_preview";
- public static final String DRM_PREVIEW_ATTRIBUTE =
- "preview";
- public static final String DRM_DEFAULT_VALUES =
- "?drm=dec+display";
- public static final String DRM_DEFAULT_VALUES_AND_PREVIEW =
- "?drm=dec+display+preview";
- public static final String DRM_FILE_SUFFIX =
- "dcf";
-
- //--------------------------------------------------
- // VARIABLES
- //--------------------------------------------------
- private M2GUrlTokenizer iTokenizer;
- private boolean iAccessRight = true;
- private String iMode = null;
-
- //--------------------------------------------------
- // METHODS
- //--------------------------------------------------
- /**
- * Ctor
- */
- public M2GConnectionPolicyImpl(M2GUrlTokenizer aTokenizer)
- {
- iTokenizer = aTokenizer;
- }
-
- /**
- * Check domain
- * @throws SecurityException if not access rights
- */
- public void checkDomain(boolean isManufacturerDomain) throws SecurityException
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "checkDomain(): manufacturer domain=" + isManufacturerDomain
- + ", mode=" + iMode + ", access right=" + iAccessRight + " - begin");
-
- // If drm mode then
- if (iMode != null)
- {
- // If dec mode and not manufacturer domain
- if (iMode.equals(DECRYPTED_MODE))
- {
- if (!isManufacturerDomain)
- {
- Logger.ELOG(Logger.EJavaUI,
- "checkDomain() - Not manufacturer and dec: SecurityException");
- throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
- }
- }
- // If default + preview mode
- else if (iMode.equals(DEFAULT_PREVIEW_MODE))
- {
- if (!isManufacturerDomain)
- {
- Logger.ELOG(Logger.EJavaUI,
- "checkDomain() - Not manufacturer and def+preview: SecurityException");
- throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
- }
- }
- // If not default mode
- else if (!iMode.equals(DEFAULT_MODE))
- {
- Logger.ELOG(Logger.EJavaUI,
- "checkDomain() - Not def nor dec: SecurityException");
- throw new SecurityException(M2GSVGConstants.ACCESS_RIGHTS_ESTR);
- }
- }
- }
-
- /**
- * Check protection type
- * @param aType If type is null then file is not drm protected.
- */
- public void checkProtectionType(String aType)
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "checkProtectionType() type=" + aType + ", mode=" + iMode +
- ", access right=" + iAccessRight + " - begin");
-
- if ((aType != null) && (!aType.equals("")))
- {
- if (iMode == null)
- {
- iMode = DEFAULT_MODE;
- iAccessRight = false;
- }
- }
-
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "checkProtectionType() mode=" + iMode + ", access right=" +
- iAccessRight + " - end");
- }
-
- /**
- * Get access rights
- * @see M2GConnectionPolicy#getAccessRight()
- */
- public boolean getAccessRight()
- {
- return iAccessRight;
- }
-
- /**
- * Initialize
- * @param aTokenizer Tokenizer
- * @throws IllegalArgumentException if drm with encrypted mode
- */
- public void initialize(M2GUrlTokenizer aTokenizer)
- {
- iAccessRight = true;
- iMode = null; // no DRM at all
- iTokenizer = aTokenizer;
- String parameters = iTokenizer.getParameters();
- int pos = -1;
- // Check if a url is something more than just a normal url.
- // Is the drm parameter within the parameters?
- if ((parameters != null) && (pos = parameters.indexOf(DRM_PARAMETER)) != 1)
- {
- pos += DRM_PARAMETER.length();
- // Encrypted mode?
- if (parameters.indexOf(ENCRYPTED_MODE, pos) != -1)
- {
- Logger.ELOG(Logger.EJavaUI, "initialize(): drm - encrypted mode");
- iAccessRight = false;
- iMode = ENCRYPTED_MODE;
- throw new IllegalArgumentException(ENC_NOT_SUPPORTED_ESTR);
- }
- // Decrypted mode?
- else if (parameters.indexOf(DECRYPTED_MODE, pos) != -1)
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "initialize(): drm - decrypted mode");
- iAccessRight = true;
- iMode = DECRYPTED_MODE;
- }
- // Default + preview mode?
- else if (parameters.indexOf(DRM_PREVIEW_ATTRIBUTE, pos) != -1)
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "initialize(): drm - decrypted mode");
- iAccessRight = false;
- iMode = DEFAULT_PREVIEW_MODE;
- }
- // Default mode
- else
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "initialize(): drm - default mode");
- iAccessRight = false;
- iMode = DEFAULT_MODE;
- }
- }
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "initialize() mode=" + iMode + ", access right="
- + iAccessRight + " - end");
- }
-
- /**
- * Get drm mode
- * @return mode. Null if no drm
- */
- public String getMode()
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "getMode(): " + iMode + "- begin");
- return iMode;
- }
-
- /**
- * Get url
- * @return File url
- */
- public String getUrl()
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "getUrl() mode=" + iMode + ", access right=" + iAccessRight + " - begin");
-
- String url = iTokenizer.getUrl();
- String parameters = iTokenizer.getParameters();
- // If normal url or default drm url
- if ((iMode == null) ||
- (iMode.equals(DEFAULT_MODE)) ||
- (iMode.equals(DEFAULT_PREVIEW_MODE)))
- {
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "getUrl() parse default url");
- // Url with preview attribute?
- if ((parameters != null) &&
- (parameters.indexOf(DRM_PREVIEW_ATTRIBUTE) != -1))
- {
- url = (iTokenizer.getBasePart() + DRM_DEFAULT_VALUES_AND_PREVIEW);
- }
- // Normal file url?
- else
- {
- // File API is able to open normal file without drm protection even
- // when the url contains the drm parameter
- url = (iTokenizer.getBasePart() + DRM_DEFAULT_VALUES);
- }
- }
- Logger.LOG(Logger.EJavaUI, Logger.EInfo,
- "getUrl(): " + url + " - end");
- return url;
- }
-}
--- a/javauis/m2g_qt/javasrc/com/nokia/microedition/m2g/connection/file/M2GConnectionProxyImpl.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-package com.nokia.microedition.m2g.connection.file;
-
-import javax.microedition.io.file.FileConnection;
-import javax.microedition.io.Connector;
-import java.io.IOException;
-import com.nokia.microedition.m2g.connection.*;
-import com.nokia.mj.impl.utils.Logger;
-
-/**
- * File connection proxy class
- */
-public class M2GConnectionProxyImpl extends M2GConnectionProxy
-{
-
- //--------------------------------------------------
- // STATIC CONSTANTS
- //--------------------------------------------------
- public static final String READ_PERMISSION =
- "javax.microedition.io.Connector.file.read";
-
- //--------------------------------------------------
- // METHODS
- //--------------------------------------------------
- /**
- * Ctor.
- */
- public M2GConnectionProxyImpl()
- {
- super();
- }
-
- /**
- * Open a connection.
- * @see connection.common.M2GConnectionProxy#open()
- */
- public void open(M2GUrlTokenizer aTokenizer) throws IOException
- {
- boolean openingStream = false;
- FileConnection connection = null;
- try
- {
- iBaseUrl = aTokenizer.getBaseUrl();
-
- // extract the suffix url from the initial url used to open the
- // file, and not the constructed (altered in default mode) url by
- // M2GConnectionPolicyImpl.
- // This suffix is passed to the external resource handler later
- iSuffixUrl = aTokenizer.getParameters();
- if (iSuffixUrl != null)
- {
- iSuffixUrl = M2GUrlTokenizer.PARAMETER_SEPARATOR + iSuffixUrl;
- }
-
- Logger.LOG(
- Logger.EJavaUI,
- Logger.EInfo,
- "file open(), suffix URI: "
- + (iSuffixUrl != null ? iSuffixUrl.toString() : "null")
- + ", create file connection - 0");
-
- M2GConnectionPolicyImpl connectionPolicy =
- new M2GConnectionPolicyImpl(aTokenizer);
-
- String uri = aTokenizer.getUrl();
-
- Logger.LOG(
- Logger.EJavaUI,
- Logger.EInfo,
- "file open(), URI: " + uri
- + ", create file connection - 2");
-
- connection = (FileConnection) Connector.open(uri,
- Connector.READ);
- openingStream = true;
- iInputStream = connection.openInputStream();
- openingStream = false;
- iConnection = connection;
- iConnectionPolicy = connectionPolicy;
- }
- finally
- {
- if ((true == openingStream) && (null != connection))
- {
- connection.close();
- }
- }
- }
-}
--- a/javauis/m2g_qt/javasrc/eclipse/swt/widgets/SVGAnimatorControl.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,438 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-package org.eclipse.swt.widgets;
-
-// this package is removed from Qt import org.eclipse.swt.internal.symbian.
-/*import org.eclipse.swt.internal.symbian.*;*/
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.widgets.Control;
-import javax.microedition.m2g.*;
-import com.nokia.microedition.m2g.*;
-import java.util.*;
-import java.lang.ref.WeakReference;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.events.*;
-import com.nokia.mj.impl.utils.Logger;
-import org.eclipse.swt.widgets.Internal_PackageSupport;
-import org.eclipse.swt.graphics.Internal_GfxPackageSupport;
-
-
-
-/**
- * Control
- */
-public class SVGAnimatorControl extends Canvas
- implements ControlListener,
- KeyListener,
- MouseListener,
- DisposeListener,
- ShellListener,
- PaintListener
-{
- //--------------------------------------------------
- // STATIC CONSTANTS
- //--------------------------------------------------
- public static final int STATE_STOPPED = 1;
- public static final int STATE_PLAYING = 2;
- public static final int STATE_PAUSED = 3;
- public static final float DEFAULT_DELTA_TIME = 0.1f;
-
- //--------------------------------------------------
- // VARIABLES
- //--------------------------------------------------
- private int iState;
- private SVGImage iSVGImage;
- private M2GScalableGraphics iSg;
- private float iDeltaTime;
- private SVGAnimatorRunnable iTask = null;
- private SVGEventListener iEventListener = null;
-
- //--------------------------------------------------
- // METHODS
- //--------------------------------------------------
-
- /**
- * @see
- */
- public SVGAnimatorControl(SVGImage aSVGImage)
- {
- iSVGImage = aSVGImage;
- iState = STATE_STOPPED;
- // Create render context, use M2GScalableGraphics
- // directly to get access to render method with native
- // side clearing parameter
- iSg = new M2GScalableGraphics();
- iSg.setRenderingQuality(ScalableGraphics.RENDERING_QUALITY_HIGH);
- iDeltaTime = DEFAULT_DELTA_TIME;
- iTask = new SVGAnimatorRunnable(this);
- }
-
- /**
- * @see org.eclipse.swt.widgets.Control#setParent()
- */
- public boolean setParent(Composite aParent)
- {
- parent = aParent;
- display = aParent.display;
-
- // Init widget after parent and display are known
- //Have to create Widget.
-//Workaround for Qt changes this method is now in with one int argument.L:\sf\app\jrt\javauis\eswt_qt\org.eclipse.swt\Eclipse SWT\qt\org\eclipse\swt\widgets\Control.java
-// int i =10;
-// createWidget(i);
-// internal_createWidget();
-
- // Add this to necessary listeners
- addControlListener(this);
- addKeyListener(this);
- addMouseListener(this);
- addDisposeListener(this);
- parent.getShell().addShellListener(this);
- addPaintListener(this);
-
- return true;
- }
-
- /**
- * @see org.eclipse.swt.widgets.Control#paint()
- */
- public void paintControl(PaintEvent e) {
- GC gc = e.gc;
-
- // Render image
- try
- {
- iSg.bindTarget(gc);
- // Parameter true to use native side clearing
- // -> animator background is always white
- iSg.render(0, 0, iSVGImage, true);
- }
- finally
- {
- iSg.releaseTarget();
- }
- }
-
- /**
- * Returns event listener
- * @return event listener
- */
- public synchronized SVGEventListener getEventListener()
- {
- return iEventListener;
- }
-
- /**
- * @see javax.microedition.m2g.SVGAnimator#getTimeIncrement()
- */
- public synchronized float getTimeIncrement()
- {
- return iDeltaTime;
- }
-
- /**
- * Increases the increment time of the SVGImage.
- * Increment is done only if the playing state is active.
- * @see javax.microedition.m2g.SVGImage#incrementTime()
- */
- public synchronized void increaseCurrentTime()
- {
- if (iState == STATE_PLAYING)
- {
- iSVGImage.incrementTime(iDeltaTime);
- }
- }
-
- /**
- * Checks if playing
- * @return true if playing
- */
- public synchronized boolean isPlaying()
- {
- return iState == STATE_PLAYING;
- }
-
- /**
- * Checks if paused
- * @return true if paused
- */
- public synchronized boolean isPaused()
- {
- return iState == STATE_PAUSED;
- }
-
- /**
- * Checks if stopped
- * @return true if stopped
- */
- public synchronized boolean isStopped()
- {
- return iState == STATE_STOPPED;
- }
-
- /**
- * @see org.eclipse.swt.events.DisposeListener#widgetDisposed()
- * @see javax.microedition.m2g.SVGEventListener#hideNotify()
- */
- public synchronized void widgetDisposed(DisposeEvent e)
- {
- if (iEventListener != null)
- {
- iEventListener.hideNotify();
- }
- }
-
- /**
- * @see org.eclipse.swt.events.ShellListener#shellActivated()
- * @see javax.microedition.m2g.SVGEventListener#showNotify()
- */
- public synchronized void shellActivated(ShellEvent e)
- {
- if (iEventListener != null)
- {
- iEventListener.showNotify();
- }
- }
-
- /**
- * @see org.eclipse.swt.events.ShellListener#shellClosed()
- * @see javax.microedition.m2g.SVGEventListener#hideNotify()
- */
- public synchronized void shellClosed(ShellEvent e)
- {
- if (iEventListener != null)
- {
- iEventListener.hideNotify();
- }
- }
-
- /**
- * @see org.eclipse.swt.events.ShellListener#shellDeactivated()
- * @see javax.microedition.m2g.SVGEventListener#hideNotify()
- */
- public synchronized void shellDeactivated(ShellEvent e)
- {
- if (iEventListener != null)
- {
- iEventListener.hideNotify();
- }
- }
-
- /**
- * @see org.eclipse.swt.events.ShellListener#shellDeiconified()
- * @see javax.microedition.m2g.SVGEventListener#hideNotify()
- */
- public synchronized void shellDeiconified(ShellEvent e)
- {
- if (iEventListener != null)
- {
- iEventListener.hideNotify();
- }
- }
-
- /**
- * @see org.eclipse.swt.events.ShellListener#shellIconified()
- * @see javax.microedition.m2g.SVGEventListener#showNotify()
- */
- public synchronized void shellIconified(ShellEvent e)
- {
- if (iEventListener != null)
- {
- iEventListener.showNotify();
- }
- }
-
- /**
- * @see org.eclipse.swt.events.KeyListener#keyPressed()
- * @see javax.microedition.m2g.SVGEventListener#keyPressed()
- */
- public synchronized void keyPressed(KeyEvent e)
- {
- if (iEventListener != null)
- {
- iEventListener.keyPressed(e.keyCode);
- }
- }
-
- /**
- * @see org.eclipse.swt.events.KeyListener#keyReleased()
- * @see javax.microedition.m2g.SVGEventListener#keyPReleased()
- */
- public synchronized void keyReleased(KeyEvent e)
- {
- if (iEventListener != null)
- {
- iEventListener.keyReleased(e.keyCode);
- }
- }
-
- /**
- * @see org.eclipse.swt.events.MouseListener#mouseDown()
- * @see javax.microedition.m2g.SVGEventListener#pointerPressed()
- */
- public synchronized void mouseDown(MouseEvent e)
- {
- if (iEventListener != null)
- {
- iEventListener.pointerPressed(e.x, e.y);
- }
- }
-
- /**
- * @see org.eclipse.swt.events.MouseListener#mouseUp()
- * @see javax.microedition.m2g.SVGEventListener#pointerReleased()
- */
- public synchronized void mouseUp(MouseEvent e)
- {
- if (iEventListener != null)
- {
- iEventListener.pointerReleased(e.x, e.y);
- }
- }
-
- /**
- * @see org.eclipse.swt.events.MouseListener#mouseDoubleClick()
- */
- public synchronized void mouseDoubleClick(MouseEvent e)
- {
- // No implementation needed
- }
-
- /**
- * @see org.eclipse.swt.events.ControlListener#controlResized()
- * @see javax.microedition.m2g.SVGEventListener#sizeChanged()
- */
- public synchronized void controlResized(ControlEvent e)
- {
- Rectangle bounds = getBounds();
- if (iEventListener != null)
- {
- iEventListener.sizeChanged(bounds.width, bounds.height);
- }
- }
-
- /**
- * @see org.eclipse.swt.events.ControlListener#controlMoved()
- */
- public synchronized void controlMoved(ControlEvent e)
- {
- // No implementation needed
- }
-
- /**
- * @see javax.microedition.m2g.SVGAnimator#pause()
- */
- public synchronized void pause()
- {
- iState = STATE_PAUSED;
- }
-
- /**
- * @see javax.microedition.m2g.SVGAnimator#play()
- */
- public synchronized void play()
- {
- if (iState == STATE_STOPPED)
- {
- // Set runnable to be run in UI thread
- display.asyncExec(iTask);
- }
- iState = STATE_PLAYING;
- }
-
- /**
- * @see javax.microedition.m2g.SVGAnimator#setSVGEventListener()
- */
- public synchronized void setEventListener(SVGEventListener eventListener)
- {
- iEventListener = eventListener;
- }
-
- /**
- * @see javax.microedition.m2g.SVGAnimator#setTimeIncrement()
- */
- public synchronized void setTimeIncrement(float aDeltaTime)
- {
- iDeltaTime = aDeltaTime;
- }
-
- /**
- * @see javax.microedition.m2g.SVGAnimator#stop()
- */
- public synchronized void stop()
- {
- iState = STATE_STOPPED;
- }
-}
-
-/**
- * SVGAnimatorRunnable
- * Runnable class to perform control redrawing.
- */
-class SVGAnimatorRunnable implements Runnable
-{
- //--------------------------------------------------
- // VARIABLES
- //--------------------------------------------------
-
- private WeakReference iWeakControl;
-
- //--------------------------------------------------
- // METHODS
- //--------------------------------------------------
-
- public SVGAnimatorRunnable(SVGAnimatorControl aControl)
- {
- iWeakControl = new WeakReference(aControl);
- }
- /*
- * @see java.lang.Runnable#run()
- */
- public void run()
- {
- SVGAnimatorControl control = (SVGAnimatorControl)iWeakControl.get();
- if (control != null && !control.isDisposed())
- {
- try
- {
- synchronized (control)
- {
- if (control.isPlaying())
- {
- // Playing: increase time
- control.increaseCurrentTime();
- }
- if (!control.isStopped())
- {
- // Playing or paused: request repainting and new run
- // If animator has been stopped no new run is requested
- control.redraw();
- control.getDisplay().timerExec(
- (int)(control.getTimeIncrement() * 1000),
- this);
- }
- }
- }
- catch (Exception e)
- {
- Logger.ELOG(Logger.EJavaUI, "SVGAnimatorRunnable: run() - exception: "
- + e.toString());
- }
- }
- }
-}
--- a/javauis/m2g_qt/javasrc/javax/microedition/m2g/ExternalResourceHandler.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/*
-* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-package javax.microedition.m2g;
-
-
-/**
-* <p>This interface is used to load external resources that are referenced
-* within a ScalableImage, namely within an SVG document in the case of SVG.
-* In SVGT 1.1, these resources are not required for displaying the SVG document.
-* If no ExternalResourceHandler is registered when creating the image,
-* the engine will retrieve these resources using its own implementation
-* of the requestResource method.</p>
-*<p>
-* The default engine behaviour can be overwritten by passing to {@link javax.microedition.m2g.ScalableImage#createImage createImage}
-* an implementation of this interface as paramater when the default implementation
-* is insufficient. For example, if the SVGImage is loaded from within a
-* Jar file, the implementation will not be able to load images that
-* have relative URIs (e.g., <image xlink:href="myImage.png" />).
-* All the external resources are requested by the engine at the time of
-* the <code>createImage</code> call. Note that SVGT 1.1 does
-* not contain external references to SVG files, therefore an external
-* resource can not contain subsequent external resources. </p>
-*
-* @see javax.microedition.m2g.ScalableImage
-*/
-public interface ExternalResourceHandler
-{
-
- /**
- * This method is invoked when an external resource is required by the underlying implementation.
- * When the request is completed by the implementation of this handler, a notification
- * must be sent to the SVG engine through the requestCompleted() method of <code>ScalableImage</code>.
- * To get a synchronous behaviour, requestCompleted() can be called in the implementation
- * of requestResource. If called later, rendering the document before
- * completing all the requests will just display the currently available content.
- * Once the request is completed, the image will have to be redrawn to reflect the newly
- * available data.
- * For more details on required resources, please refer to the <code>externalResourcesRequired</code>
- * attribute description in the SVG specification.
- *
- * @param image image that originated the external data request
- * @param URI the URI for the external resource.
- */
- public void requestResource(ScalableImage image, String URI);
-
-};
--- a/javauis/m2g_qt/javasrc/javax/microedition/m2g/SVGAnimator.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,302 +0,0 @@
-/*
-* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-package javax.microedition.m2g;
-
-import com.nokia.microedition.m2g.M2GSVGAnimator;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.widgets.Display;
-import com.nokia.microedition.m2g.M2GSVGeSWTAnimator;
-/**
- * The <code>SVGAnimator</code> class handles automatic rendering of updates and
- * animations in an <code>SVGImage</code> to a target user interface (UI) component.
- *
- * The target component type depends on the Java profile this specification is
- * implemented on, as described in the <code>createAnimator</code> and
- * <code>getTargetComponent</code> methods documentation.
- *
- * There are two types of rendering updates the <code>SVGAnimator</code> handles:
- *
- * <ul>
- * <li><b>Animation Updates.</b> The <code>SVGAnimator</code> can run animations
- * and automatically and periodically refreshes its rendering to
- * reflect the effect of animations.</li>
- * <li><b>SVGImage Updates.</b> The <code>SVGAnimator</code> updates its rendering
- * following alterations of the associated <code>SVGImage</code>,
- * for example if the position of one of the graphical elements is
- * modified by an API call.</li>
- * </ul>
- *
- * An <code>SVGAnimator</code> instance can be in one of the following states:
- * <ul>
- * <li><b>Stopped</b>. This is the initial state. The <code>SVGAnimator</code>
- * performs no rendering updates. <br/>
- * Possible transitions:
- * <ul>
- * <li>To the <i>playing</i> state, with the <code>play</code> method.</li>
- * </ul>
- * </li>
- *
- * <li><b>Playing</b>. This is the typical state for an
- * <code>SVGAnimator</code>. In that state, the <code>SVGAnimator</code>
- * performs both Animation and SVGImage updates.
- *
- * While there are active animations,
- * the animator updates the rendering at a rate not faster than the one
- * defined by the <code>setTimeIncrement</code> method. If SVGImage updates are made
- * (e.g., with calls to the <code>SVGElement</code>
- * <code>setTrait</code> method, see examples), the rendering is updated at the time of
- * the next animation rendering.<br />
- *
- * When there are no active animations, the animator will update the rendering
- * after each <code>Runnable</code> passed to the <code>invokeLater</code> or
- * <code>invokeAndWait</code> methods has finished executing.
- * <br/>
- * Possible transitions:
- * <ul>
- * <li>To the <i>stopped</i> state, with the <code>stop</code> method.</li>
- * <li>To the <i>paused</i> state, with the <code>pause</code> method.</li>
- * </ul>
- * </li>
- *
- * <li><b>Paused</b>. When in that state, the <code>SVGAnimator</code> only
- * performs SVGImage updates rendering. The animator no longer automatically
- * advances the SVG document's current time, so rendering reflects the animation
- * at the document's current time. Note that a change to the document's current
- * time while in the <i>paused</i> state will trigger a new rendering for the
- * new current time.
- * <br/>
- * Possible transitions:
- * <ul>
- * <li>To the <i>stopped</i> state, with the <code>stop</code> method.</li>
- * <li>To the <i>playing</i> state, with the <code>play</code> method.</li>
- * </ul>
- * </li>
- * </ul>
- *
- * <b>Code example:</b><br />
- * <pre>
- * // Create an SVGAnimator
- * SVGImage map = ...; // See the SVGImage documentation.
- *
- * SVGAnimator svgAnimator = SVGAnimator.createAnimator(map);
- *
- * // Display the associated SVGAnimator component.
- * // Depends on the platform.
- *
- * // =============== AWT Example ===============
- * Panel panel = ....;
- * panel.add((Component) svgAnimator.getTargetComponent());
- * ...
- *
- * // =============== MIDP Example ===============
- * Canvas svgCanvas = (Canvas) svgAnimator.getTargetComponent());
- * ...
- *
- * // Start rendering animations.
- * svgAnimator.play();
- * ....
- * class MapRunnable implements Runnable {
- * public void run() {
- * // Perform map updates based on current
- * // traffic information.
- * SVGElement statusRect
- * = map.getDocument().getElementById("statusRect");
- *
- * // Reflect that traffic status.
- * statusRect.setRGBTrait(...); // See setRGBTrait documentation.
- * }
- * }
- *
- * Runnable mapUpdates = new MapRunnable();
- * ....
- *
- * while (someLoopCondition) {
- * if(hasMapUpdate) {
- * svgAnimator.invokeAndWait(mapUpdates);
- * }
- * }
- * </pre>
- */
-public abstract class SVGAnimator
-{
- /**
- * This method creates a new <code>SVGAnimator</code> for the specified SVGImage.
- *
- * @param svgImage the <code>SVGImage</code> this animator should render.
- * @return a new <code>SVGAnimator</code> instance.
- * @throws NullPointerException if <code>svgImage</code> is null.
- */
- public static SVGAnimator createAnimator(SVGImage svgImage)
- {
- SVGAnimator tempAnimator = null;
-
- System.out.println("P-Do In CreateAnimator if.");
-
- tempAnimator=M2GSVGeSWTAnimator.buildAnimator(svgImage);
-
- System.out.println("P-Do In CreateAnimator tempAnimator Creif.");
-
- //tempAnimator=M2GSVGAnimator.buildAnimator(svgImage);
-
- return tempAnimator;
- }
-
- /**
- * This method creates a new <code>SVGAnimator</code> for the specified SVGImage.
- *
- * The following components types must be supported:
- *
- * <ul>
- * <li> "javax.microedition.lcdui.Canvas" on profiles supporting LCDUI</li>
- * <li> "java.awt.Component" on profiles supporting AWT</li>
- * </ul>
- *
- * On platforms that support the Swing UI component framework, the
- * "javax.swing.JComponent" string may be used to request a Swing component.
- *
- * @param svgImage the <code>SVGImage</code> this animator should render.
- * @param componentBaseClass the desired base class for the component associated
- * with the animator. This is used when the platform this specification
- * is implemented on supports multiple UI component frameworks. If
- * componentBaseClass is null, this is equivalent to invoking the
- * <code>createAnimator</code> method with the svgImage parameter only.
- * @return a new <code>SVGAnimator</code> instance.
- * @throws NullPointerException if <code>svgImage</code> is null.
- * @throws IllegalArgumentException if the requested
- * <code>componentBaseClass</code> is not supported by the
- * implementation.
- */
- public static SVGAnimator createAnimator(
- SVGImage svgImage, String componentBaseClass)
- {
- System.out.println("P-Do In CreateAnimator of SVGAnimator.");
-
- SVGAnimator tempAnimator = null;
- tempAnimator=M2GSVGeSWTAnimator.buildAnimator(svgImage);
-// TODO Check for the toolkit?? tempAnimator=M2GSVGAnimator.buildAnimator(svgImage, componentBaseClass);
- return tempAnimator;
- }
-
- /**
- * The type of target component associated with the animator depends on the
- * Java profile this specification is implemented on:
- *
- * <ul>
- * <li> javax.microedition.lcdui.Canvas on profiles supporting LCDUI</li>
- * <li> java.awt.Component on profiles supporting AWT</li>
- * </ul>
- * @return target the target component associated with the animator.
- * @see #createAnimator
- */
- public abstract Object getTargetComponent();
-
- /**
- * Returns the current time increment used for animation rendering. The
- * SVGAnimator increments the SVG document's current time by this amount
- * between each rendering.
- *
- * @return the current time increment used for animation rendering. The default
- * value is 0.1 (100 milliseconds)
- * @see #setTimeIncrement
- */
- public abstract float getTimeIncrement();
-
- /**
- * Invoke the input Runnable in the Document update thread and return after
- * the Runnable has completed.
- *
- * @param runnable the new Runnable to invoke.
- * @throws java.lang.InterruptedException if the current thread is waiting,
- * sleeping, or otherwise paused for a long time and another thread
- * interrupts it.
- * @throws NullPointerException if <code>runnable</code> is null.
- * @throws IllegalStateException if the animator is in the <i>stopped</i> state.
- */
- public abstract void invokeAndWait(
- Runnable runnable) throws InterruptedException;
-
- /**
- * Schedule the input Runnable for execution in the update thread at a later time.
- *
- * @param runnable the new Runnable to execute in the Document's update
- * thread when time permits.
- * @throws NullPointerException if <code>runnable</code> is null.
- * @throws IllegalStateException if the animator is in the <i>stopped</i> state.
- */
- public abstract void invokeLater(java.lang.Runnable runnable);
-
- /**
- * Transitions this <code>SVGAnimator</code> to the <i>paused</i> state.
- * The <code>SVGAnimator</code> stops advancing the document's current time
- * automatically (see the SVGDocument's setCurrentTime method). As a result,
- * animations are paused until another call to the <code>play</code> method
- * is made, at which points animations resume from the document's current
- * time. SVGImage updates (through API calls) trigger a rendering update
- * while the <code>SVGAnimator</code> is in the <i>paused</i> state.
- *
- * @throws IllegalStateException if the animator is not in the <i>playing</i>
- * state.
- */
- public abstract void pause();
-
- /**
- * Transitions this <code>SVGAnimator</code> to the <i>playing</i>
- * state. While in the <i>playing</i> state, both Animation and SVGImage
- * updates trigger rendering updates. Note that a change to the document's
- * current time while in the playing state will cause the animator to seek
- * to the new time, and continue to play animations forward.
- *
- * @throws IllegalStateException if the animator is not currently in
- * the <i>stopped</i> or <i>paused</i> state.
- */
- public abstract void play();
-
- /**
- * Sets the time increment to use for animation rendering.
- *
- * @param timeIncrement the minimal time that should ellapse between frame
- * rendering. In seconds. Should be greater than zero.
- * @throws IllegalArgumentException if timeIncrement is less than or equal to
- * zero.
- * @see #getTimeIncrement
- */
- public abstract void setTimeIncrement(float timeIncrement);
-
- /**
- * Sets the <code>SVGEventListener</code> associated with this
- * <code>SVGAnimator</code>.
- *
- * @param svgEventListener the new SVGEventListener which will receive
- * events forwarded by this <code>SVGAnimator</code>. May be null,
- * in which case events are not forwarded by the <code>SVGAnimator</code>.
- */
- public abstract void setSVGEventListener(SVGEventListener svgEventListener);
-
- /**
- * Transitions this <code>SVGAnimator</code> to the <i>stopped</i> state.
- * This causes the <code>SVGAnimator</code> to stop advancing the document's
- * current time automatically, and no rendering updates are performed while
- * in <i>stopped</i> state. A call to the <i>play</i> method will cause
- * the animations to resume from the document's current time.
- *
- * @throws IllegalStateException if the animator is not in the <i>playing</i>
- * or <i>paused</i> state.
- */
- public abstract void stop();
-}
--- a/javauis/m2g_qt/javasrc/javax/microedition/m2g/SVGEventListener.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,233 +0,0 @@
-/*
-* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-package javax.microedition.m2g;
-
-/**
- * The <code>SVGEventListener</code> is used to forward platform specific events
- * to an application. The application can implement this interface and, in
- * response, dispatch SVG events on an <code>SVGImage</code> object.
- * <br />
- * <br>
- * <br>
- * <b>Code example:</b>
- * <pre>
- *
- * // Create an SVGAnimator
- * SVGImage map = ...; // See the SVGImage documentation.
- * SVGAnimator svgAnimator = SVGAnimator.createAnimator(map);
- *
- * // Create an SVGEventListener and set it on the animator.
- * MIDPSVGEventListener listener = new MIDPSVGEventListener(map, animator);
- * svgAnimator.setSVGEventListener(listener);
- *
- * //
- * // SVGEventListener sample implementation. Adds a new
- * // circle every time a key is pressed.
- * //
- * class MIDPSVGEventListener implements SVGEventListener, Runnable {
- * protected SVGDocument svgDocument;
- * protected SVGAnimator svgAnimator;
- * protected Vector addToTree = new Vector();
- *
- * public MIDPSVGEventListener(SVGImage svgImage, SVGAnimator animator) {
- * this.svgDocument = svgImage.getDocument();
- * this.svgAnimator = svgAnimator;
- * }
- *
- * public void keyPressed(int keyCode) {
- * SVGElement circle = svgDocument.createElementNS(svgNS, "circle");
- * circle.setFloatTrait("cx", ...);
- * circle.setFloatTrait("cy", ...);
- * // ....
- *
- * // We synchronized access to the addToTree vector because
- * // it is accessed from different threads. Because we do
- * // no know how fast this runnable is going to be scheduled
- * // by the animator, it is possible that multiple circles
- * // be created before the run() method is invoked. This explain
- * // why we put all the newly created circles in a Vector and why
- * // the run method inserts the current content of the vector
- * // into the SVG document.
- * synchronized (addToTree) {
- * addToTree.addElement(circle);
- * }
- *
- * svgAnimator.invokeLater(this);
- * }
- *
- * public run() {
- * synchronized (addToTree) {
- * for (int i = 0; i < addToTree.size(); i++) {
- * svgDocument.getDocumentElement().appendChild(
- * (SVGElement) addToTree.elementAt(i));
- * }
- * addToTree.clear();
- * }
- * }
- * }
- * </pre>
- *
- */
-public interface SVGEventListener
-{
- /**
- * Invoked by the SVG implementation when the associated component is
- * hidden.
- *
- * On MIDP, this method is invoked when the
- * <code>javax.microedition.lcdui.Canvas.hideNotify</code> method is invoked.
- *
- * On AWT, this method is invoked when the <code>java.awt.event.ComponentEvent</code>
- * with type <code>java.awt.event.ComponentEvent.COMPONENT_HIDDEN</code> is
- * invoked on a <code>java.awt.Component</code>'s component listener.
- *
- */
- void hideNotify();
-
- /**
- * Invoked by the SVG implementation when a key was pressed while the
- * component associated with the <code>SVGAnimator</code> had focus.
- *
- * On MIDP, this method is invoked when the
- * <code>javax.microedition.lcdui.Canvas.keyPressed()</code> method is
- * invoked.
- *
- * On AWT, this method is invoked when the
- * <code>java.awt.event.KeyListener.keyPressed()</code> method is invoked on
- * a <code>java.awt.Component</code>'s key listener.
- *
- * @param keyCode the code of the key that was pressed. For MIDP, the code
- * is the same as for the <code>javax.microedition.lcdui.Canvas</code>
- * <code>keyPressed</code> <code>keyCode</code> argument. For AWT, the code
- * is the same as in the <code>java.awt.event.KeyEvent.getKeyCode()</code>
- * method.
- */
- void keyPressed(int keyCode);
-
- /**
- * Invoked by the SVG implementation when a key was released while the
- * component associated with the <code>SVGAnimator</code> had focus.
- *
- * On MIDP, this method is invoked when the
- * <code>javax.microedition.lcdui.Canvas.keyReleased()</code> method is
- * invoked.
- *
- * On AWT, this method is invoked when the
- * <code>java.awt.event.KeyListener.keyReleased()</code> method is invoked on
- * a <code>java.awt.Component</code>'s key listener.
- *
- * @param keyCode the code of the key that was pressed. For MIDP, the code
- * is the same as for the <code>javax.microedition.lcdui.Canvas</code>
- * <code>keyReleased</code> <code>keyCode</code> argument. For AWT, the code
- * is the same as in the <code>java.awt.event.KeyEvent.getKeyCode()</code>
- * method.
- */
- void keyReleased(int keyCode);
-
- /**
- * Invoked by the SVG implementation when the pointer device (if any), is
- * pressed over the component associated with the <code>SVGAnimator</code>.
- *
- * On MIDP, this method is invoked when the
- * <code>javax.microedition.lcdui.Canvas.pointerPressed()</code> method is
- * invoked. Note that pointer events are only supported on MIDP if the
- * platform supports them, as defined by the
- * <code>Canvas.hasPointerEvents</code> method.
- *
- * On AWT, this method is invoked when the
- * <code>java.awt.event.MouseListener.mousePressed()</code> method is invoked on
- * a <code>java.awt.Component</code>'s mouse listener.
- *
- * @param x the x-axis coordinate, in the target component's space (i.e.,
- * relative to the upper left corner of the component associated with the
- * <code>SVGAnimator</code>. On MIDP, this is the same value as passed to the
- * <code>javax.microedition.midp.Canvas.pointerPressed()</code> method. On
- * AWT, this is the same value as returned from the
- * <code>java.awt.event.MouseEvent.getX()</code> method.
- *
- * @param y the y-axis coordinate, in the target component's space (i.e.,
- * relative to the upper left corner of the component associated with the
- * <code>SVGAnimator</code>. On MIDP, this is the same value as passed to the
- * <code>javax.microedition.midp.Canvas.pointerPressed()</code> method. On
- * AWT, this is the same value as returned from the
- * <code>java.awt.event.MouseEvent.getY()</code> method.
- */
- void pointerPressed(int x, int y);
-
- /**
- * Invoked by the SVG implementation when the pointer device (if any), is
- * released over the component associated with the <code>SVGAnimator</code>.
- *
- * On MIDP, this method is invoked when the
- * <code>javax.microedition.lcdui.Canvas.pointerReleased()</code> method is
- * invoked. Note that pointer events are only supported on MIDP if the
- * platform supports them, as defined by the
- * <code>Canvas.hasPointerEvents</code> method.
- *
- * On AWT, this method is invoked when the
- * <code>java.awt.event.MouseListener.mouseReleased()</code> method is invoked on
- * a <code>java.awt.Component</code>'s mouse listener.
- *
- * @param x the x-axis coordinate, in the target component's space (i.e.,
- * relative to the upper left corner of the component associated with the
- * <code>SVGAnimator</code>. On MIDP, this is the same value as passed to the
- * <code>javax.microedition.midp.Canvas.pointerReleased()</code> method. On
- * AWT, this is the same value as returned from the
- * <code>java.awt.event.MouseEvent.getX()</code> method.
- *
- * @param y the y-axis coordinate, in the target component's space (i.e.,
- * relative to the upper left corner of the component associated with the
- * <code>SVGAnimator</code>. On MIDP, this is the same value as passed to the
- * <code>javax.microedition.midp.Canvas.pointerReleased()</code> method. On
- * AWT, this is the same value as returned from the
- * <code>java.awt.event.MouseEvent.getY()</code> method.
- */
- void pointerReleased(int x, int y);
-
- /**
- * Invoked by the SVG implementation when the associated component is
- * shown.
- *
- * On MIDP, this method is invoked when the
- * <code>javax.microedition.lcdui.Canvas.showNotify</code> method is invoked.
- *
- * On AWT, this method is invoked when the <code>java.awt.event.ComponentEvent</code>
- * with type <code>java.awt.event.ComponentEvent.COMPONENT_SHOWN</code> is
- * invoked on a <code>java.awt.Component</code>'s component listener.
- *
- */
- void showNotify();
-
- /**
- * Invoked by the SVG implementation when the associated component is
- * resized.
- *
- * On MIDP, this method is invoked when the
- * <code>javax.microedition.lcdui.Canvas.sizeChanged</code> method is invoked.
- *
- * On AWT, this method is invoked when the <code>java.awt.event.ComponentEvent</code>
- * with type <code>java.awt.event.ComponentEvent.COMPONENT_RESIZED</code> is
- * invoked on a <code>java.awt.Component</code>'s component listener.
- *
- * @param width the new component width.
- * @param height the new component height.
- */
- void sizeChanged(int width, int height);
-}
-
--- a/javauis/m2g_qt/javasrc/javax/microedition/m2g/SVGImage.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,294 +0,0 @@
-/*
-* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-package javax.microedition.m2g;
-
-//--------------------------------------------------
-//Imports
-//--------------------------------------------------
-import java.io.*;
-import java.io.InputStream;
-import org.w3c.dom.Document;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.svg.SVGElement;
-import com.nokia.microedition.m2g.M2GSVGImage;
-
-/**
-* This class represents an SVG image conforming to the W3C SVG Tiny 1.1 Profile. Applications can access the Document
-* associated with this SVGImage using <code>getDocument</code> method. Using the <code>Document</code> class,
-* it is possible to interact with the content and perform operations such as zoom, pan, and rotate
-* apart from various other functions. The event dispatching methods as described
-* in this class must be used for dispatching user specific events to the underlying SVG engine.
-*
-* <p>
-* The width and height values specified in the SVGImage are only used to compute the initial viewport width/height.
-* It is also important to note that according to the SVG 1.1 specification, if viewBox is not defined, then
-* the preserveAspectRatio attribute is ignored. Therefore, the contents should not be scaled if there is no
-* viewBox defined.
-* </p>
-* <p><b>Note:</b> If the application does not have the necessary privilege rights to access this (SVG)
-* content, a SecurityException may be thrown by the underlying implementation. This is applicable
-* to all the tree navigation (see {@link org.w3c.dom.Node Node}) and trait acessor methods (see {@link org.w3c.dom.svg.SVGElement SVGElement}).
-* Features such as zooming, panning and playing of animations will not be affected.
-* <p>
-* Here is the list of events supported in this specification:
-* <p>
-* <table cellpadding="2" cellspacing="2" border="1"
- * style="border-collapse: collapse;">
- * <tbody>
- * <tr>
- * <th width="150" valign="top" bgcolor="#999999"><b>Events<br>
- * </b> </th>
- * <th valign="top" bgcolor="#999999"><b>Description<br>
- * </b> </th>
- * </tr>
- * <tr>
- * <td valign="top"> <b>"DOMFocusIn"</b><br>
- * </td>
- * <td valign="top"> Occurs when the element comes into focus.<br>
- * </td>
- * </tr>
- * <tr>
- * <td valign="top"> <b>"DOMFocusOut"</b><br>
- * </td>
- * <td valign="top"> Occurs when an element goes out of focus.<br>
- * </td>
- * </tr>
- * <tr>
- * <td valign="top"> <b>"DOMActivate"</b><br>
- * </td>
- * <td valign="top"> Occurs when an element is activated, for instance, through a keypress (select)<br>
- * </td>
- * </tr>
- * <tr>
- * <td valign="top"> <b>"click"</b><br>
- * </td>
- * <td valign="top"> Occurs when the pointing device button is clicked over the SVG content (or particular SVGElement) <br>
- * </td>
- * </tr>
- * </tbody>
- * </table>
-* @see javax.microedition.m2g.ScalableImage
-* @see org.w3c.dom.Document
-*/
-
-public class SVGImage extends ScalableImage
-{
- //--------------------------------------------------
- // VARIABLES
- //--------------------------------------------------
- private M2GSVGImage iImg = null;
-
- /**
- * Constructor
- */
- protected SVGImage()
- {
- super();
- }
-
- /**
- * This method is used to dispatch an "DOMActivate" event to the document.
- * The element that has focus is activated, which means that a
- * "DOMActivate" event with the the currently focused element as target is
- * dispatched. If no element has focus, this method does not do anything
- * and no event is dispatched.
- */
- public void activate()
- {
- iImg.activate();
- }
-
- /**
- * This method creates and loads an empty SVGImage (skeleton) that can be used to
- * programatically construct a simple SVG image. Note: A root <svg> element
- * with default viewport size of 100x100 is also created inside this method.
- *
- * <p>If an handler is specified, the engine will invoke it for any external resource
- * referenced in the document. If the handler is set to null, the SVGImage will try to
- * load images automatically using the engine default implementation,but might not be
- * able to load all of them.</p>
- *
- * <p>Note that the <code>handler</code> is also called when the xlink:href attribute on
- * <image> is set or changed by the application, but the call is made only when the
- * element is hooked into the document tree i.e. when the ancestors go all the way up to
- * the root <svg> element. There are two cases:
- * <ul>
- * <li>When changing the xlink:href attribute of an existing <image> element that is already hooked or part of the tree.</li>
- * <li>When creating a new <image>, setting its xlink:href and hooking it to the document tree.</li>
- * </ul>
- * </p>
- *
- * @param handler implementation of the ExternalResourceHandler interface
- * @see javax.microedition.m2g.ExternalResourceHandler
- *
- * @return an empty SVGImage
- */
- public static SVGImage createEmptyImage(ExternalResourceHandler handler)
- {
- M2GSVGImage image = M2GSVGImage.buildEmptyImage(handler);
- if (image == null)
- {
- throw new NullPointerException();
- }
- SVGImage proxy = new SVGImage();
- proxy.iImg = image;
- return proxy;
- }
-
- /**
- * @see javax.microedition.m2g.ScalableImage
- */
- public static ScalableImage createImage(
- InputStream stream, ExternalResourceHandler handler) throws IOException
- {
- M2GSVGImage image = M2GSVGImage.buildImage(stream, handler, null, null);
- if (image == null)
- {
- throw new NullPointerException();
- }
- SVGImage proxy = new SVGImage();
- proxy.iImg = image;
- return proxy;
- }
-
- /**
- * @see javax.microedition.m2g.ScalableImage
- */
- public static ScalableImage createImage(
- String url, ExternalResourceHandler handler) throws IOException
- {
- M2GSVGImage image = M2GSVGImage.buildImage(url, handler);
- if (image == null)
- {
- throw new NullPointerException();
- }
- SVGImage proxy = new SVGImage();
- proxy.iImg = image;
- return proxy;
- }
-
- /**
- * This method is used to dispatch a mouse event of the specified <code>type</code> to the
- * document. The mouse position is given as screen coordinates <code>x, y</code>. If the
- * x, y values are outside the viewport area or no target is available for the x, y
- * coordinates, the event is not dispatched. Note that when a "click" event is dispatched,
- * a "DOMActivate" is automatically dispatched by the underlying implementation. The only
- * required mouse event type is "click". Therefore, if an unsupported type is specified,
- * a DOMException with error code NOT_SUPPORTED_ERR is thrown.
- *
- *
- * @param type the type of mouse event.
- * @param x the x location of the mouse/pointer in viewport coordinate
- * system.
- * @param y the y location of the mouse/pointer in viewport coordinate
- * system.
- * @throws DOMException with error code NOT_SUPPORTED_ERR: if the event <code>type</code> is not supported.
- * @throws NullPointerException if <code>type</code> is null.
- * @throws IllegalArgumentException if the x or y values are negative.
- *
- */
- public void dispatchMouseEvent(String type, int x, int y) throws DOMException
- {
- iImg.dispatchMouseEvent(type, x, y);
- }
-
- /**
- * Returns the associated <code>Document</code>.
- * @return the associated <code>Document</code>.
- */
- public Document getDocument()
- {
- return iImg.getDocument();
- }
-
- /**
- * @see javax.microedition.m2g.ScalableImage
- */
- public int getViewportHeight()
- {
- return iImg.getViewportHeight();
- }
-
- /**
- * @see javax.microedition.m2g.ScalableImage
- */
- public int getViewportWidth()
- {
- return iImg.getViewportWidth();
- }
-
- /**
- * This method triggers a "DOMFocusIn" event with the specified element as
- * the event target. That element becomes the element with focus. This
- * method also triggers a "DOMFocusOut" event with the element which
- * previous had focus as target. When the activate method is called, a
- * "DOMActivate" event is triggered with the currently focused element as
- * the target. The initial focus is always <code>null</code> and setting
- * <code>null</code> will remove the current focus.
- *
- * @param element the element to set the focus on.
- * @throws DOMException with error code WRONG_DOCUMENT_ERR: if invalid element is passed (for
- * ex: an element that does not belong to this document).
- */
- public void focusOn(SVGElement element) throws DOMException
- {
- iImg.focusOn(element);
- }
-
- /**
- * Increments the animation or media timeline for this SVGImage (in seconds). As the name
- * implies, this method is intended to move only forward in the timeline and typically should be used
- * to animate SVG content when the SVGAnimator class in not used. Setting negative values will throw
- * an Exception. It is important to note that setting large increments of time would result in
- * skipping parts of the animation as per the SVG animation model.
- *
- * @param seconds the value of time to increment in seconds.
- * @throws IllegalArgumentException if the specified time is negative.
- */
- public void incrementTime(float seconds)
- {
- iImg.incrementTime(seconds);
- }
-
- /**
- * @see javax.microedition.m2g.ScalableImage
- */
- public void requestCompleted(
- String URI, InputStream resourceData) throws IOException
- {
- iImg.requestCompleted(URI, resourceData);
- }
-
- /**
- * @see javax.microedition.m2g.ScalableImage
- */
- public void setViewportHeight(int height)
- {
- iImg.setViewportHeight(height);
- }
-
- /**
- * @see javax.microedition.m2g.ScalableImage
- */
- public void setViewportWidth(int width)
- {
- iImg.setViewportWidth(width);
- }
-}
-
--- a/javauis/m2g_qt/javasrc/javax/microedition/m2g/ScalableGraphics.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,146 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-package javax.microedition.m2g;
-
-import com.nokia.microedition.m2g.M2GScalableGraphics;
-
-/**
- * This is the fundamental class for 2D rendering. The ScalableGraphics context class
- * provides and handles all the rendering capability within this package. In other
- * words, the rendering can only be achieved through the render method provided
- * in this class. Note that the ScalableGraphics instance must be bound to the rendering
- * target prior to calling the render method. The implementation must clip to the
- * viewport boundaries.
-*/
-public class ScalableGraphics
-{
- // Defines a low rendering quality level.
- public static final int RENDERING_QUALITY_LOW = 1;
- // Defines a high rendering quality level.
- public static final int RENDERING_QUALITY_HIGH = 2;
-
- private M2GScalableGraphics iSg;
-
- /**
- * Constructor
- */
- private ScalableGraphics()
- {
- System.out.println("P-In ScalableGraphics() Creating iSg" );
- iSg = new M2GScalableGraphics();
- System.out.println("P-OUT ScalableGraphics() Creating iSg" );
- }
-
- /**
- * Binds the given Graphics as the rendering target of this ScalableGraphics context. The
- * type of the Graphics object depends on the Java profile that this specification is
- * implemented on, as follows:
- * <ul>
- * <li> javax.microedition.lcdui.Graphics on profiles supporting LCDUI;</li>
- * <li> java.awt.Graphics on profiles supporting AWT;</li>
- * <li> either of the above on profiles supporting both AWT and LCDUI.</li>
- * </ul>
- * @param target the object (Graphics) to receive the rendered image.
- * @throws NullPointerException if <code>target</code> is null.
- * @throws IllegalArgumentException if <code>target</code> is invalid.
- * @throws IllegalStateException if <code>target</code> is already bound.
- */
- public void bindTarget(java.lang.Object target)
- {
- System.out.println("P-In Bind Target of ScalableGraphics.java" );
- iSg.bindTarget(target);
- System.out.println("P-Out Bind Target of ScalableGraphics.java" );
- }
-
- /**
- * Retrieve a new instance of ScalableGraphics that can be associated to
- * an application.
- * <p>
- * @return the newly created <code>ScalableGraphics</code> instance.
- */
- public static ScalableGraphics createInstance()
- {
- return new ScalableGraphics();
- }
-
- /**
- * Flushes the rendered ScalableImage to the currently bound target and then releases
- * the target. This ensures that the ScalableImage is actually made visible on the target
- * that was set in bindTarget. Otherwise, the image may or may not become visible.
- * @throws IllegalStateException if <code>target</code> is not bound.
- */
- public void releaseTarget()
- {
- System.out.println("P-In Release Target of ScalableGraphics.java" );
- iSg.releaseTarget();
- System.out.println("P-Out Release Target of ScalableGraphics.java" );
- }
-
- /**
- * Renders the specified ScalableImage using the supplied anchor point. The anchor point given
- * is relative to the upper left corner of the rendering surface. It is important to note that
- * the content is made visible or flushed to the display only after a call is made to
- * <code>releaseTarget</code>.
- * @param x the X coordinate of the anchor point, in pixels.
- * @param y the Y coordinate of the anchor point, in pixels.
- * @param image the ScalableImage to be rendered.
- * @throws NullPointerException if <code>image</code> is null.
- * @throws IllegalStateException if <code>target</code> is not bound.
- * @see #releaseTarget
- */
- public void render(int x, int y, ScalableImage image)
- {
- System.out.println("P-In Render Target of ScalableGraphics.java" );
- iSg.render(x,y, image);
- System.out.println("P-Out Render Target of ScalableGraphics.java" );
- }
-
- /**
- * Set the quality of rendering in the ScalableGraphics context. It can take one of the values,
- * RENDERING_QUALITY_LOW or RENDERING_QUALITY_HIGH. Default=RENDERING_QUALITY_HIGH. The
- * implementation of these quality levels is implementation dependent and should be mapped
- * to definitions in SVG spec (shape, text, image and color rendering).
- * @param mode this value indicates the quality of rendering required.
- * @throws IllegalArgumentException if the <code>mode</code> is invalid.
- */
-
- public void setRenderingQuality(int mode)
- {
- iSg.setRenderingQuality(mode);
- }
-
- /**
- * Set the transparency in the ScalableGraphics context with the supplied alpha value.
- * Alpha value must be a floating point number in the range [0.0, 1.0]. The source pixels
- * are always combined with destination pixels using the <i>Source Over Destination</i>
- * rule [Porter-Duff]. In this context, the Source Over Destination rule has the following
- * properties: a fully opaque pixel in the source must replace the destination pixel, a
- * fully transparent pixel in the source must leave the destination pixel unchanged, and
- * a semitransparent pixel in the source must be alpha blended with the destination pixel using
- * the supplied value. The default alpha value is 1.0 (fully opaque), when not specified.
- *
- * @param alpha the constant alpha value to be used for rendering.
- *
- * @throws IllegalArgumentException if <code>alpha</code> is out of range.
- */
- public void setTransparency(float alpha)
- {
- iSg.setTransparency(alpha);
- }
-}
--- a/javauis/m2g_qt/javasrc/javax/microedition/m2g/ScalableImage.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,225 +0,0 @@
-/*
-* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-package javax.microedition.m2g;
-
-import java.io.IOException;
-
-/**
- * This class models images in vector format, such as the Scalable Vector
- * Graphics (SVG) image format. Therefore, it is required that all classes
- * representing "scalable" images extend this class.
- * @see javax.microedition.m2g.SVGImage
- */
-public abstract class ScalableImage
-{
- /**
- * Constructor
- */
- protected ScalableImage()
- {
- }
-
- /**
- * This method creates and loads a ScalableImage (e.g. SVG) from the specified stream.
- * A ScalableImage can only be rendered using the render() method in the ScalableGraphics
- * context.The image size is determined by the content specification
- * (eg: width/height attributes on root SVG element). The default viewport size
- * of 100-by-100 pixels is used when the size is unspecified. This method will throw an exception
- * when the image is in error. For SVG document, the document is in error when:
- * <ul>
- * <li>the SVG document does not conform to the XML 1.0 specification</li>
- * <li>an element has an attribute or property value which is not permissible according to the SVG specification </li>
- * <li>the required or mandatory attributes according to the SVG specification are missing</li>
- * <li>the document contains circular references on the <use> element</li>
- * <li>the document contains <image> element(s) with local references </li>
- * <li>the document contains elements with duplicate Id's</li>
- * <li>the document contains animation(s) in error</li>
- * </ul>
- *
- * <p>If an <code>handler</code> is specified, the engine will invoke it for any
- * external resource referenced in the document. However, please note that data URIs
- * (for ex: base64 encoded images like <image xlink:href="data:image/png;base64,/9j/4AAQ..."/>)
- * are required to be decoded by the engine, and therefore the handler will not be invoked
- * in such cases. All these requests must occur before createImage returns, and the
- * engine must only make one call if there exist multiple resources
- * with the same URI. If the <code>handler</code> is set to null, the ScalableImage
- * will try to load images automatically using the engine's default implementation,
- * but might not be able to load all of them. For example, if the ScalableImage
- * is loaded from a file in a Jar file, the implementation will not be able
- * to load images that have relative URIs (ex; <image xlink:href="myImage.png" />).
- * If the handler is not able to locate a requested resource, it informs the SVG engine
- * by calling the requestCompleted method with <code>null</code> for resourceData. </p>
- *
- * <p>Note that the <code>handler</code> is also called when the xlink:href attribute on
- * <image> is set or changed by the application, but the call is made only when the
- * element is hooked into the document tree i.e. when the ancestors go all the way up to
- * the root <svg> element. There are two cases:
- * <ul>
- * <li>When changing the xlink:href attribute of an existing <image> element that is already hooked or part of the tree.</li>
- * <li>When creating a new <image>, setting its xlink:href and hooking it to the document tree.</li>
- * </ul>
- * </p>
- *
- * @param stream The stream from which the SVG content should be read.
- * @param handler implementation of the ExternalResourceHandler interface
- * @see javax.microedition.m2g.ExternalResourceHandler
- *
- * @return the loaded ScalableImage.
- * @throws IOException if an error occurs while loading the content.
- * @throws NullPointerException if <code>stream</code> is null.
- */
- public static ScalableImage createImage(java.io.InputStream stream,
- ExternalResourceHandler handler) throws IOException
- {
- return SVGImage.createImage(stream, handler);
- }
-
-
- /**
- * This method creates and loads a ScalableImage (e.g. SVG) with the specified
- * URI. A ScalableImage can only be rendered using the render() method in the ScalableGraphics
- * context.The image size is determined by the content specification
- * (eg: width/height attributes on root SVG element). The default viewport size
- * of 100-by-100 pixels is used when the size is unspecified. This method will throw an
- * exception when the image is in error. For SVG document, the document is in error when:
- * <ul>
- * <li>the SVG document does not conform to the XML 1.0 specification</li>
- * <li>an element has an attribute or property value which is not permissible according to the SVG specification </li>
- * <li>the required or mandatory attributes according to the SVG specification are missing</li>
- * <li>the document contains circular references on the <use> element</li>
- * <li>the document contains <image> element(s) with local references </li>
- * <li>the document contains elements with duplicate Id's</li>
- * <li>the document contains animation(s) in error</li>
- * </ul>
- *
- *
- * <p>If an <code>handler</code> is specified, the engine will invoke it for any
- * external resource referenced in the document. However, please note that data URIs
- * (for ex: base64 encoded images like <image xlink:href="data:image/png;base64,/9j/4AAQ..."/>)
- * are required to be decoded by the engine, and therefore the handler will not be invoked
- * in such cases. All these requests must occur before createImage returns, and the
- * engine must only make one call if there exist multiple resources
- * with the same URI. If the <code>handler</code> is set to null, the ScalableImage
- * will try to load images automatically using the engine's default implementation,
- * but might not be able to load all of them. For example, if the ScalableImage
- * is loaded from a file in a Jar file, the implementation will not be able
- * to load images that have relative URIs (ex: <image xlink:href="myImage.png" />).
- * If the handler is not able to locate a requested resource, it informs the SVG engine
- * by calling the requestCompleted method with <code>null</code> for resourceData. </p>
- *
- * <p>Note that the <code>handler</code> is also called when the xlink:href attribute on
- * <image> is set or changed by the application, but the call is made only when the
- * element is hooked into the document tree i.e. when the ancestors go all the way up to
- * the root <svg> element. There are two cases:
- * <ul>
- * <li>When changing the xlink:href attribute of an existing <image> element that is already hooked or part of the tree.</li>
- * <li>When creating a new <image>, setting its xlink:href and hooking it to the document tree.</li>
- * </ul>
- * </p>
- *
- * <p>
- * If the platform implementation supports the JSR-75 FileConnection, then the file: URLs
- * as used by JSR-75 shall be supported and the images are loaded from files identified
- * by this locator. This can be used to load possible DRM protected image files from the
- * file system.
- *
- * @param url A string in URL syntax that identifies the image source.
- * @param handler implementation of the ExternalResourceHandler interface
- * @see javax.microedition.m2g.ExternalResourceHandler
- *
- * @return the loaded ScalableImage
- * @throws IOException if an error occurs while loading the SVG content.
- * @throws NullPointerException if <code>URL</code> is null.
- * @throws java.lang.IllegalArgumentException if the specified locator is of unsupported type.
- * @throws SecurityException if the application does not have the privilege rights to access
- * the contents of this resource.
- *
- */
- public static ScalableImage createImage(String url,
- ExternalResourceHandler handler) throws IOException
- {
- return SVGImage.createImage(url, handler);
- }
-
- /**
- * This method returns the ScalableImage's viewport height. The initial
- * viewport height is taken from the "height" value specified in the Scalable Image. The value
- * returned is always in pixels. If the specified height is defined in percentages, the
- * values are mapped to the default view port size of 100x100. If the viewport height
- * is explicitly changed by the application, then the percentages are ignored and the content
- * is made to fit to this new viewport height.
- *
- * @return the current height of this ScalableImage.
- * @see #setViewportHeight
- */
- public abstract int getViewportHeight();
-
- /**
- * This method returns the ScalableImage's viewport width. The initial
- * viewport width is taken from the "width" value specified in the Scalable Image. The value
- * returned is always in pixels. If the specified width is defined in percentages, the
- * values are mapped to the default view port size of 100x100. If the viewport width
- * is explicitly changed by the application, then the percentages are ignored and the content
- * is made to fit to this new viewport width.
- *
- * @return the current width of this ScalableImage.
- * @see #setViewportWidth
- */
- public abstract int getViewportWidth();
-
- /**
- * Once the requested external resource is available, the application forwards this information
- * (resourceData) to the SVG engine. If this method is called a second time for a same URL of a
- * same <code>SVGImage</code>, the engine will replace the current resource data with the new
- * one. <b>Note:</b> Setting <code>null</code> for resourceData indicates that the requested resource
- * could not be fetched by the <code>ResourceHandler</code> or application, and in this
- * event the SVG engine will not make further attempts to load this resource.
- *
- * @param URI URI that was requested through requestExternalResource
- * @param resourceData inputstream containing the external resource
- *
- * @see javax.microedition.m2g.ExternalResourceHandler
- *
- * @throws IOException if an error occurs while loading the resource.
- * @throws NullPointerException if URL is null.
- */
- public abstract void requestCompleted(String URI, java.io.InputStream resourceData) throws IOException;
-
- /**
- * This method sets the new (viewport) height of this ScalableImage.
- *
- * @param height the new height to be set.
- * @see #getViewportHeight
- * @throws IllegalArgumentException if height is negative.
- */
- public abstract void setViewportHeight(int height);
-
- /**
- * This method sets the new (viewport) width of this ScalableImage.
- * The viewport is the area where the ScalableImage is rendered. Any parts
- * of the viewport that lie outside the boundaries of the target clipping
- * rectangle are clipped. The viewport upper left corner (x, y) is given
- * relative to the upper left corner of the target rendering surface.
- *
- * @param width the new width to be set.
- * @see #getViewportWidth
- * @throws IllegalArgumentException if width is negative.
- */
- public abstract void setViewportWidth(int width);
-}
--- a/javauis/m2g_qt/javasrc/org/w3c/dom/DOMException.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-package org.w3c.dom;
-
-/**
- *
- */
-public class DOMException extends RuntimeException
-{
-
- /**
- * If a node is used in a different document than the one that created it
- * (that doesn't support it).
- */
- public static final short WRONG_DOCUMENT_ERR = 4;
-
- /**
- * If index or size is negative, or greater than the allowed value.
- */
- public static final short INDEX_SIZE_ERR = 1;
-
- /**
- * If any Node is inserted somewhere it doesn't belong.
- */
- public static final short HIERARCHY_REQUEST_ERR = 3;
-
- /**
- * If an attempt is made to modify an object where modifications are not allowed.
- */
- public static final short NO_MODIFICATION_ALLOWED_ERR = 7;
-
- /**
- * If an attempt is made to reference a {@link org.w3c.dom.Node Node} in a context where it does not exist. See {@link org.w3c.dom.Node#insertBefore insertBefore} for example.
- */
- public static final short NOT_FOUND_ERR = 8;
-
- /**
- * If the implementation does not support the requested type of object or operation.
- */
- public static final short NOT_SUPPORTED_ERR = 9;
-
- /**
- * If an attempt is made to use an object that is not, or is no longer, usable.
- */
- public static final short INVALID_STATE_ERR = 11;
-
- /**
- * If an attempt is made to modify the type of the underlying object.
- */
- public static final short INVALID_MODIFICATION_ERR = 13;
-
- /**
- * If a parameter or an operation is not supported by the underlying object.
- */
- public static final short INVALID_ACCESS_ERR = 15;
-
- /**
- * If the type of an object is incompatible with the expected type of the parameter associated to the object.
- */
- public static final short TYPE_MISMATCH_ERR = 17;
-
- /**
- *
- * The member variable to store exception's code, like INVALID_ACCESS_ERR.
- */
- public short code;
-
- /**
- * Constructs a DOMException with a detailed message.
- *
- * @param code the exception's error code.
- * @param message the exception's descriptive message.
- */
- public DOMException(final short code,
- final String message)
- {
- super(message);
- this.code = code;
- }
-
-
-}
--- a/javauis/m2g_qt/javasrc/org/w3c/dom/Document.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-package org.w3c.dom;
-
-/**
- * The Document interface represents an XML Document.
- *
- * <p>This interface is a subset of the Document interface defined
- * in the <a href="http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html">
- * DOM Level 3 Core</a>.</p>
- *
- *
- * <p>Note the behavior of the following methods from the
- * <code>Node</code> interface when called on a <code>Document</code>
- * object:
- *
- * <ul>
- * <li>getParentNode returns <code>null</code></li>
- * <li>appendChild throws <code>HIERARCHY_REQUEST_ERR</code></li>
- * <li>insertBefore throws <code>HIERARCHY_REQUEST_ERR</code></li>
- * <li>removeChild throws <code>NOT_SUPPORTED_ERR</code></li>
- * </ul>
- * </p>
- *
- */
-public interface Document extends Node
-{
-
- /**
- * Create a new <code>Element</code> based on the specified
- * (qualified) SVG tag name. This JSR does not require multiple
- * namespaces and may throw a <code>DOMException</code> with a
- * code of <code>NOT_SUPPORTED_ERR</code> if the URI is not the
- * SVG namespace URI, or if the specified name is not a valid SVG
- * Tiny element name. Only the following elements must be supported:
- * <rect>, <circle>, <ellipse>, <line>,
- * <path> <use> <image> <text>,
- * <a> and <g>.
- *
- * @param namespaceURI the namespace uri for the newly created
- * element. This should always be the SVG namespace URI "http://www.w3.org/2000/svg".
- * @param qualifiedName the qualified name for the newly created
- * element (For example: "rect", to create a <rect> element)
- *
- * @return the newly created SVG Element.
- *
- * @throws DOMException NOT_SUPPORTED_ERR if the type of element is
- * not supported by the implementation. JSR 226 only requires creation
- * support for some of the SVG namespace elements and only for a limited
- * number of local names in that namespace (see above documentation).Therefore, in
- * a conformant JSR 226 implementation, trying to create elements with a namespace
- * URIs other than the SVG namespace URI and with a qualified name not in the list
- * of required qualified names may result in this exception being thrown.
- * @throws NullPointerException if <code>namespaceURI</code> or
- * <code>qualifiedName</code> is null.
- *
- */
- public Element createElementNS(String namespaceURI, String qualifiedName)
- throws DOMException;
-
- /**
- * Return a child element of this document Node which corresponds to the top-most
- * tag in XML file. For SVG files it must be <code>SVGSVGElement</code>, but return
- * type is Element for DOM Core compatibility and to allow for future extensions.
- *
- * @return the root <code>Element</code> associated with this
- * document.
- * @throws SecurityException if the application does not have the necessary privilege rights
- * to access this (SVG) content.
- */
-
- public Element getDocumentElement();
-
- /**
- * Return the <code>Element</code> in the current document with
- * the given unique ID. If no such element exists, this returns null.
- *
- * @param id the ID of the object to be retrieved.
- * @return the Element that matches with the given ID or
- * <code>null</code> if the ID is not present.
- *
- * @throws NullPointerException if id is null
- * @throws SecurityException if the application does not have the necessary privilege rights
- * to access this (SVG) content.
- */
-
- public Element getElementById(String id);
-
-}
-
--- a/javauis/m2g_qt/javasrc/org/w3c/dom/Element.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-package org.w3c.dom;
-
-
-/**
- * This empty interface is defined to ensure compatibility with the DOM
- * specification, and also to be used as a return type of some Document
- * methods.
- *
- */
-public interface Element extends Node
-{
-}
--- a/javauis/m2g_qt/javasrc/org/w3c/dom/Node.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,132 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-package org.w3c.dom;
-
-/**
- * The Node interface describes generic nodes in an SVG document tree.
- *
- * <p>This interface is a subset of the Node interface defined
- * in the <a href="http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html">
- * DOM Level 3 Core</a>.</p>
- *
- */
-
-public interface Node
-{
-
-
- /**
- * Returns the namespace URI of the Node.
- *
- * @return the namespace URI of the Node.
- * @throws SecurityException if the application does not have the necessary privilege rights
- * to access this (SVG) content.
- */
- public String getNamespaceURI();
-
- /**
- * Returns the local part of the qualified name of this node. If the node is of type SVGElement, this returns the tag name without a prefix.
- * But, if the node is of type Document then <code>null</code> is returned.
- * @return the local part of the qualified name of this node.
- * @throws SecurityException if the application does not have the necessary privilege rights
- * to access this (SVG) content.
- */
-
- public String getLocalName();
-
- /**
- * Returns the parent <code>Node</code> of this <code>Node</code>.
- *
- * @return the parent node or null if there is no parent (i.e. if a node has
- * just been created and not yet added to the tree, or if it has been removed
- * from the tree, this is null).
- * @throws SecurityException if the application does not have the necessary privilege rights
- * to access this (SVG) content.
- */
-
- public Node getParentNode();
-
- /**
- * Appends a child to this <code>Node</code>.
- *
- * @param newChild the <code>Node</code> to be appended to this
- * <code>Node</code>. This is equivalent to insertBefore(newChild,null)
- * @return the added <code>Node</code>.
- *
- * @throws DOMException with error code HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children
- * of the type of the newChild node, or if the node to append is one of this node's ancestors or this node itself,
- * or if this node is of type Document and the DOM application attempts to append a second Element node.
- * @throws DOMException with error code WRONG_DOCUMENT_ERR: Raised if newChild was created from a different document than
- * the one that created this node.
- * @throws DOMException with error code NOT_SUPPORTED_ERR: if the newChild node is a child of the Document node or if the
- * child is of a type that cannot be created with createElementNS.
- * @throws DOMException with error code INVALID_STATE_ERR: if the newChild node would cause the document to go into
- * error, for ex: when the newChild contains a <use> element with an invalid xlink:href attribute.
- * @throws NullPointerException if <code>newChild</code> is null.
- * @throws SecurityException if the application does not have the necessary privilege rights
- * to access this (SVG) content.
- */
-
- public Node appendChild(Node newChild) throws DOMException;
-
- /**
- * Removes the specified child associated with this Node. Elements that have ids cannot be
- * removed from the tree.
- *
- * @param oldChild the <code>Node</code> that is to be removed.
- * @return the node removed.
- * @throws DOMException with error code NOT_FOUND_ERR: Raised if oldChild is not a child of this node.
- * @throws DOMException with error code NOT_SUPPORTED_ERR: if this node is of type Document or if the
- * child, or any of its descendants, is of a type that cannot be created with createElementNS.
- * @throws DOMException with error code INVALID_ACCESS_ERR: if the element being removed or one of its decendants
- * have non-null id.
- * @throws NullPointerException if <code>oldChild</code> is null.
- * @throws SecurityException if the application does not have the necessary privilege rights
- * to access this (SVG) content.
- */
-
- public Node removeChild(Node oldChild) throws DOMException;
-
- /**
- * Inserts newChild before refChild in the child list for this node. If refChild is null,
- * newChild is inserted at the end of the list. If the newChild is already part of the
- * tree, it is first removed.
- *
- *
- * @param newChild the child to add
- * @param refChild the child before which the new child should be added.
- * @return the node being inserted.
- * @throws DOMException with error code HIERARCHY_REQUEST_ERR: if this node is of a type that does not allow children
- * of the type of the newChild node, or if the node to append is one of this node's ancestors or this node itself,
- * or if this node is of type Document and the DOM application attempts to append a second Element node.
- * @throws DOMException with error code WRONG_DOCUMENT_ERR: Raised if newChild was created from a different document than
- * the one that created this node.
- * @throws DOMException with error code NOT_FOUND_ERR: raised if refChild is not a child of this node.
- * @throws DOMException with error code NOT_SUPPORTED_ERR: if the newChild node is a child of the Document node or if the
- * child is of a type that cannot be created with createElementNS.
- * @throws DOMException with error code INVALID_STATE_ERR: if the newChild node would cause the document to go into
- * error, for ex: when the newChild contains a <use> element with an invalid xlink:href attribute.
- * @throws NullPointerException if <code>newChild</code> is null.
- * @throws SecurityException if the application does not have the necessary privilege rights
- * to access this (SVG) content.
- */
-
- public Node insertBefore(Node newChild, Node refChild) throws DOMException;
-
-
-}
--- a/javauis/m2g_qt/javasrc/org/w3c/dom/events/Event.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-package org.w3c.dom.events;
-
-import java.lang.String;
-
-/**
- * The Event interface is used to provide contextual information about an event to the handler
- * processing the event. An object which implements the Event interface is passed as the first
- * parameter to the {@link org.w3c.dom.events.EventListener#handleEvent handleEvent} call. If
- * an event target is an element instance (see <a href="http://www.w3.org/TR/SVG11/struct.html#InterfaceSVGElementInstance">SVGElementInstance</a>), the currentTarget is an implementation of EventTarget
- * that does not implement the Node interface.
- */
-
-public interface Event
-{
- /**
- * This method is used to get the current target of this event.
- * In SVG Tiny, this is always an object to which event listener was attached.
- *
- * @return the event's <code>EventTarget</code>.
- */
- public EventTarget getCurrentTarget();
-
- /**
- * This method returns the event type information. The name of the event is case-sensitive.
- * The following event types are supported:
- * <br>
- * <b>click</b>, <b>DOMActivate</b>, <b>DOMFocusIn</b>, <b>DOMFocusOut</b> (defined DOM Events);
- * @return the event's type.
- */
- public String getType();
-
-
-}
--- a/javauis/m2g_qt/javasrc/org/w3c/dom/events/EventListener.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-package org.w3c.dom.events;
-
-/**
-* This interface represents an event listener, and is a subset of the EventListener interface
-* defined in the <a href="http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/idl-definitions.html">
-* DOM Level 2 Event model</a>.
-* <p>
-* This interface must be implemented and registered on an EventTarget using the
-* {@link org.w3c.dom.events.EventTarget#addEventListener addEventListener} method to be notified
-* about events that occur on or bubble through the event target.
-*
-*
-*/
-
-public interface EventListener
-{
-
- /**
- * This method is called whenever an event occurs of the type for which the
- * EventListener interface was registered.. The Event object contains the
- * necessary information pertaining to the event, such as its
- * target and type.
- *
- * @param evt the Event object containing necessary event information.
- */
- public void handleEvent(Event evt);
-
-}
--- a/javauis/m2g_qt/javasrc/org/w3c/dom/events/EventTarget.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-package org.w3c.dom.events;
-
-import org.w3c.dom.DOMException;
-
-/**
-*
-* This interface represents an event target, and is a subset of the EventTarget interface
-* defined in the <a href="http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/idl-definitions.html">
-* DOM Level 2 Event model</a>.
-* <br>
-* This interface is implemented by an object (SVGElements) that can notify listeners about events and allows
-* registration and removal of {@link org.w3c.dom.events.EventListener EventListener} objects.
-*
-*
-*/
-
-public interface EventTarget
-{
-
- /**
- * This method registers the specified listener with the event target. If an EventListener is added to an EventTarget
- * while it is processing an event, it will not be triggered by the current actions. If multiple identical EventListeners
- * are registered on the same EventTarget with the same parameters the duplicate instances are discarded. They do not cause
- * the EventListener to be called twice and since they are discarded they do not need to be removed with the removeEventListener
- * method.
- *
- * @param type The type of event to listen to.
- * @param listener Will be notified when an event of the desired type happens on this target or one of its descendant.
- * @param useCapture If true, the listener will be called during the event flow capture phase. Otherwise, the listener
- * will be called during the bubble phase. If the event's target is this target, then the listener will be called during the 'at target' phase of event flow.
- *
- * @throws DOMException with error code NOT_SUPPORTED_ERR if useCapture is true since capture phase is not supported in SVG Tiny.
- * @throws NullPointerException if <code>listener</code> is null.
- * @throws NullPointerException if <code>type</code> is null.
- */
- public void addEventListener(String type, EventListener listener, boolean useCapture);
-
- /**
- * This method removes the specified listener from the event target. If an EventListener is removed
- * from an EventTarget while it is processing an event, it will not be triggered by the current actions. Calling removeEventListener
- * with arguments which do not identify any currently registered EventListener on the EventTarget has no effect.
- *
- * @param type The type of event that was listened to.
- * @param listener The listener that was previously registered.
- * @param useCapture If true, the listener was listening to events in the capture phase of event flow, otherwise the listener
- * was listening to events in the bubble phase.
- *
- * @throws DOMException with error code NOT_SUPPORTED_ERR if useCapture is true since capture phase is not supported in SVG Tiny.
- * @throws NullPointerException if <code>listener</code> is null.
- * @throws NullPointerException if <code>type</code> is null.
- */
- public void removeEventListener(String type, EventListener listener, boolean useCapture);
-
-}
\ No newline at end of file
--- a/javauis/m2g_qt/javasrc/org/w3c/dom/svg/SVGAnimationElement.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-package org.w3c.dom.svg;
-
-
-/**
- * This interface represents an Animation element, which contains methods to control the timing of
- * animations.
- */
-public interface SVGAnimationElement extends SVGElement
-{
-
- /**
- * Creates a begin instance time for the current time plus or minus the passed offset.
- * The new instance time is added to the <a href="http://www.w3.org/TR/2001/REC-smil20-20010807/smil20.html#smil-timing-Timing-BeginEnd-InstanceTimesLists">
- * begin instance times list</a>.
-
- *
- * @param offset The offset in seconds at which to begin the element.
- */
- public void beginElementAt(float offset);
-
- /**
- * Creates an end instance time for the current time plus or minus the passed offset.
- * The new instance time is added to the <a href="http://www.w3.org/TR/2001/REC-smil20-20010807/smil20.html#smil-timing-Timing-BeginEnd-InstanceTimesLists">
- * end instance times list</a>.
-
- *
- * @param offset The offset in seconds at which to end the element.
- */
- public void endElementAt(float offset);
-
-}
--- a/javauis/m2g_qt/javasrc/org/w3c/dom/svg/SVGElement.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1051 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-package org.w3c.dom.svg;
-
-import org.w3c.dom.DOMException;
-
-import org.w3c.dom.Element;
-import org.w3c.dom.events.EventTarget;
-
-/**
- * This interface represents an SVG element in the document tree. Element's id can be set only
- * if it does not already have an id. {@link org.w3c.dom.DOMException DOMException} with error
- * code NO_MODIFICATION_ALLOWED_ERR is raised if an attempt is made to change an existing id.
- * Elements with non-null id can be inserted, but <b>cannot be removed</b> from the DOM tree
- * (see {@link org.w3c.dom.Node#removeChild removeChild}). This interface also provides methods
- * to traverse elements in the DOM tree.
- *
- * <p>
- * This interface can also be used read and manipulate the value of "traits" associated with this
- * SVGElement. Each <i>trait</i> corresponds to an attribute or property,which is parsed and
- * understood by the element and in most cases animatable. Unlike attributes, each element has a
- * well-defined set of traits and attempting to access undefined trait is an error. Also unlike
- * attributes traits are typed and their values are normalized; for instance SVG path specification
- * is parsed and all path commands are converted to their absolute variants, it is not possible to
- * say through the value of the trait if a path command was absolute or relative. When getting and
- * setting trait values, accessor of the correct type must be used or exception will be thrown.
- * </p>
- * <p>
- * Initial trait values come from parsing corresponding attributes. If value is not specified, but
- * corresponing attribute (or property for environments where styling is supported) is inherited,
- * inherited value is returned as a result of the trait query method. If it is not inherited, default
- * value is returned. Default values are also returned in the case when there is no parent to inherit
- * from, for ex: when you create a new element, set a trait value to 'inherit', but there is no parent for
- * inheritance. It is important to note that the value which is returned is always a base value (i.e. before animation
- * is applied), and this is true for both static and animated content.
- * </p>
- * <p>
- * Setting a trait value has the same effect as changing a corresponding attribute, but trait
- * setters can operate on typed values. The value which is modified is always a base value.
- * For inheritable traits the trait value can always be set to "inherit"
- * (but querying the value will always return the actual inherited value as explained above).
- * </p>
- * <p>
- * There are two situations where the various trait setter methods (such as
- * setTrait, setFloatTrait or setPathTrait methods) consider a value
- * invalid and throw a DOMException with the INVALID_ACCESS_ERR code.
- * The first situation is when the trait value is invalid with regards to
- * its definition (for example, trying to set the "stroke-linejoin" trait
- * to "foo" would cause this exception).
- * The second situation is when the trait value is invalid with regards to
- * animations currently applied to the trait. The value is considered
- * invalid because it would put the animation, and therefore the document,
- * in an error state. For example, if a <path> element has animations on
- * its "d" attribute, trying to change the "d" attribute to a value
- * incompatible with the animations will cause the exception to happen.
- * </p>
- *
- * <h3>Traits supported in this specification, SVG Tiny 1.1 DOM</h3>
- *
- *
- * <p>The table below shows the list of attributes and properties that SVG Tiny
- * DOM 1.1 implementations must support. Each light gray section lists one or
- * multiple elements for which the subsequent attributes or properties
- * apply. Each attribute row lists the allowed getter and setter (s). The last
- * column specifies the default values that must be used for each attribute or
- * property.</p>
- * <p><b>Note:</b> For 'REQUIRED' attributes, there are two cases:
- *
- * <ul>
- * <li>i) The document is in error, if this attribute was not present at the time of loading.</li>
- * <li>ii) When using uDOM API, the specified default value (in parenthesis) must be used.</li>
- * </ul>
- * </p>
- *
- * <table height="1586" cellpadding="2" cellspacing="2" border="1"
- * width="825" style="border-collapse: collapse;">
- * <tbody>
- * <tr>
- * <th width="150" valign="top" bgcolor="#999999"><b>Property<br>
- * </b> </th>
- * <th valign="top" bgcolor="#999999"><b>Trait Getter <br>[possible return value(s)]<br>
- * </b> </th>
- * <th bgcolor="#999999" valign="top"><b>Trait Setter <br>[allowed value(s)]<br>
- * </b> </th>
- * <th bgcolor="#999999" valign="top"><b>Default Values<br>
- * </b> </th>
- * </tr>
- * <tr>
- * <td valign="top"><br>
- * </td>
- * <td valign="top"><br>
- * </td>
- * <td valign="top"><br>
- * </td>
- * <td valign="top"><br>
- * </td>
- * </tr>
- * <tr>
- * <td bgcolor="#cccccc" colspan="4" rowspan="1" valign="top"><svg>,
- * <rect>, <circle>, <ellipse>, <line>,
- * <path>, <g>, <image>, <text>, <a>, and <use></td>
- * </tr>
- * <tr>
- * <td width="150" valign="top">color <br>
- * </td>
- * <td valign="top">getRGBColorTrait [SVGRGBColor]<br>
- * </td>
- * <td valign="top">setTrait [inherit]<br>setRGBColorTrait [SVGRGBColor]<br>
- * </td>
- * <td valign="top" align="center">rgb(0,0,0)<br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" valign="top">display<br>
- * </td>
- * <td valign="top">getTrait [inline | none ] <br>
- * </td>
- * <td valign="top">setTrait [inline | none | inherit ] </td>
- * <td valign="top" align="center">"inline"<br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" valign="top">fill<br>
- * </td>
- * <td valign="top">getRGBColorTrait [null, SVGRGBColor]<br>
- * </td>
- * <td valign="top">setRGBColorTrait [SVGRGBColor]<br>setTrait(none | currentColor | inherit)<br>
- * </td>
- * <td valign="top" align="center">rgb(0,0,0)<br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" valign="top">fill-rule<br>
- * </td>
- * <td valign="top">getTrait [nonzero | evenodd] <br>
- * </td>
- * <td valign="top">setTrait [nonzero | evenodd | inherit] </td>
- * <td valign="top" align="center">"nonzero"<br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" valign="top">stroke</td>
- * <td valign="top">getRGBColorTrait [null, SVGRGBColor]</td>
- * <td valign="top">setRGBColorTrait [SVGRGBColor]<br>setTrait [none | currentColor | inherit]</td>
- * <td valign="top" align="center">"none"<br>
- * </td>
- * </tr>
- * <tr>
- * <td valign="top">stroke-dashoffset</td>
- * <td valign="top">getFloatTrait </td>
- * <td valign="top">setTrait [inherit]<br>setFloatTrait </td>
- * <td valign="top" align="center">0.0f<br>
- * </td>
- * </tr>
- * <tr>
- * <td valign="top">stroke-linecap</td>
- * <td valign="top">getTrait [butt | round | square]</td>
- * <td valign="top">setTrait [butt | round | square | inherit]</td>
- * <td valign="top" align="center">"butt"<br>
- * </td>
- * </tr>
- * <tr>
- * <td valign="top">stroke-linejoin</td>
- * <td valign="top">getTrait [miter | round | bevel ]</td>
- * <td valign="top">setTrait [miter | round | bevel | inherit]</td>
- * <td valign="top" align="center">"miter"<br>
- * </td>
- * </tr>
- * <tr>
- * <td valign="top">stroke-miterlimit</td>
- * <td valign="top">getFloatTrait [ value >= 1]</td>
- * <td valign="top">setTrait [inherit]<br>setFloatTrait [value >= 1]</td>
- * <td valign="top" align="center">4.0f<br>
- * </td>
- * </tr>
- * <tr>
- * <td valign="top">stroke-width</td>
- * <td valign="top">getFloatTrait [value >= 0]</td>
- * <td valign="top">setTrait [inherit]<br> setFloatTrait [value >= 0]</td>
- * <td valign="top" align="center">1.0f<br>
- * </td>
- * </tr>
- * <tr>
- * <td valign="top">visibility</td>
- * <td valign="top">getTrait [visible | hidden]</td>
- * <td valign="top">setTrait [visible | hidden | inherit]</td>
- * <td valign="top" align="center">"visible"<br>
- * </td>
- * </tr>
- * <tr>
- * <td valign="top"><br>
- * </td>
- * <td valign="top"><br>
- * </td>
- * <td valign="top"><br>
- * </td>
- * <td valign="top"><br>
- * </td>
- * </tr>
- * <tr>
- * <td bgcolor="#cccccc" colspan="4" rowspan="1" valign="top"><svg>, <text>, <g>, <a>, and <use>;<br>
- * </td>
- * </tr>
- * <tr>
- * <td valign="top">font-family<br>
- * </td>
- * <td valign="top">getTrait [single, computed font-family value]<br>
- * </td>
- * <td valign="top">setTrait [same syntax as font-family attribute]<br>
- * </td>
- * <td valign="top" align="center"> User-Agent <br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" valign="top">font-size<br>
- * </td>
- * <td valign="top">getFloatTrait [value >= 0]<br>
- * </td>
- * <td valign="top">setFloatTrait [value >= 0]<br>setTrait [inherit]<br>
- * </td>
- * <td valign="top" align="center"> User-Agent <br>
- * </td> </tr>
- * <tr>
- * <td width="150" valign="top">font-style<br>
- * </td>
- * <td valign="top">getTrait [normal | italic | oblique ] </td>
- * <td valign="top">setTrait [normal | italic | oblique | inherit] </td>
- * <td valign="top" align="center">"normal"<br>
- * </td> </tr>
- * <tr>
- * <td width="150" valign="top">font-weight<br>
- * </td>
- * <td valign="top">getTrait [100 | 200 | 300 <br> | 400 | 500 | 600 | 700 | 800 | 900 ] </td>
- * <td valign="top">setTrait [normal | bold | bolder | lighter | 100 | 200 | 300 <br />
- * | 400 | 500 | 600 | 700 | 800 | 900 | inherit] </td>
- * <td valign="top" align="center">"normal"<br>
- * </td> </tr>
- * <tr>
- * <td width="150" valign="top">text-anchor<br>
- * </td>
- * <td valign="top">getTrait [start | middle | end]<br>
- * </td>
- * <td valign="top">setTrait [start | middle | end | inherit ]<br>
- * </td>
- * <td valign="top" align="center">"start"<br>
- * </td> </tr>
- * <tr>
- * <td width="150" colspan="4" rowspan="1" valign="top"><br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" bgcolor="#999999" valign="top"><b>Attribute<br>
- * </b></td>
- * <td bgcolor="#999999" valign="top"><b>Trait Getter<br>
- * </b></td>
- * <td bgcolor="#999999" valign="top"><b>Trait Setter<br>
- * </b></td>
- * <td bgcolor="#999999" valign="top"><b>Default Values<br>
- * </b></td>
- * </tr>
- * <tr>
- * <td width="150" valign="top"><br>
- * </td>
- * <td valign="top"><br>
- * </td>
- * <td valign="top"><br>
- * </td>
- * <td valign="top"><br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" bgcolor="#cccccc" colspan="4" rowspan="1" valign="top">
- * <rect>, <circle>, <ellipse>, <line>, <path>, <g>,
- * <image>, <text>, <a>, and <use></td>
- * </tr>
- * <tr>
- * <td width="150" valign="top">transform<br>
- * </td>
- * <td valign="top">getMatrixTrait [SVGMatrix]<br>
- * </td>
- * <td valign="top">setMatrixTrait [SVGMatrix]<br>
- * </td>
- * <td valign="top" align="center">Identity matrix<br>
- * (1,0,0,1,0,0)<br>
- * </tr>
- * <tr>
- * <td width="150" valign="top"><br>
- * </td>
- * <td valign="top"><br>
- * </td>
- * <td valign="top"><br>
- * </td>
- * <td valign="top"><br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" colspan="4" rowspan="1" bgcolor="#cccccc" valign="top"><rect><br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" valign="top">height<br>
- * </td>
- * <td valign="top">getFloatTrait [ value >= 0]<br>
- * </td>
- * <td valign="top">setFloatTrait [ value >= 0]<br>
- * </td>
- * <td valign="top" align="center">REQUIRED<br>(0.0f)<br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" valign="top">width<br>
- * </td>
- * <td valign="top">getFloatTrait [ value >= 0]</td>
- * <td valign="top">setFloatTrait [ value >= 0]</td>
- * <td valign="top" align="center">REQUIRED<br>(0.0f)<br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" valign="top">x<br>
- * </td>
- * <td valign="top">getFloatTrait<br>
- * </td>
- * <td valign="top">setFloatTrait<br>
- * </td>
- * <td valign="top" align="center">0.0f<br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" valign="top">y<br>
- * </td>
- * <td valign="top">getFloatTrait<br>
- * </td>
- * <td valign="top">setFloatTrait<br>
- * </td>
- * <td valign="top" align="center">0.0f<br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" valign="top">rx<br>
- * </td>
- * <td valign="top">getFloatTrait [value >= 0]</td>
- * <td valign="top">setFloatTrait [value >= 0]</td>
- * <td valign="top" align="center">0.0f<br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" valign="top">ry<br>
- * </td>
- * <td valign="top">getFloatTrait [value >= 0]<br>
- * </td>
- * <td valign="top">setFloatTrait [value >= 0]<br>
- * </td>
- * <td valign="top" align="center">0.0f<br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" valign="top"><br>
- * </td>
- * <td valign="top"><br>
- * </td>
- * <td valign="top"><br>
- * </td>
- * <td valign="top"><br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" colspan="4" rowspan="1" bgcolor="#cccccc" valign="top"><circle><br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" valign="top">cx<br>
- * </td>
- * <td valign="top">getFloatTrait<br>
- * </td>
- * <td valign="top">setFloatTrait<br>
- * </td>
- * <td valign="top" align="center">0.0f<br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" valign="top">cy<br>
- * </td>
- * <td valign="top">getFloatTrait<br>
- * </td>
- * <td valign="top">setFloatTrait<br>
- * </td>
- * <td valign="top" align="center">0.0f<br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" valign="top">r<br>
- * </td>
- * <td valign="top">getFloatTrait [ value >= 0]<br>
- * </td>
- * <td valign="top">setFloatTrait [value >= 0]<br>
- * </td>
- * <td valign="top" align="center">REQUIRED<br>(0.0f)<br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" valign="top"><br>
- * </td>
- * <td valign="top"><br>
- * </td>
- * <td valign="top"><br>
- * </td>
- * <td valign="top"><br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" bgcolor="#cccccc" colspan="4" rowspan="1" valign="top"><ellipse><br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" valign="top">cx<br>
- * </td>
- * <td valign="top">getFloatTrait<br>
- * </td>
- * <td valign="top">setFloatTrait<br>
- * </td>
- * <td valign="top" align="center">0.0f<br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" valign="top">cy<br>
- * </td>
- * <td valign="top">getFloatTrait<br>
- * </td>
- * <td valign="top">setFloatTrait<br>
- * </td>
- * <td valign="top" align="center">0.0f<br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" valign="top">rx<br>
- * </td>
- * <td valign="top">getFloatTrait [value >= 0]<br>
- * </td>
- * <td valign="top">setFloatTrait [value >= 0]<br>
- * </td>
- * <td valign="top" align="center">REQUIRED<br>(0.0f)<br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" valign="top">ry<br>
- * </td>
- * <td valign="top">getFloatTrait [value >= 0]<br>
- * </td>
- * <td valign="top">setFloatTrait [value >= 0]<br>
- * </td>
- * <td valign="top" align="center">REQUIRED<br>(0.0f)<br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" valign="top"><br>
- * </td>
- * <td valign="top"><br>
- * </td>
- * <td valign="top"><br>
- * </td>
- * <td valign="top"><br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" colspan="4" rowspan="1" bgcolor="#cccccc" valign="top"><line><br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" valign="top">x1<br>
- * </td>
- * <td valign="top">getFloatTrait<br>
- * </td>
- * <td valign="top">setFloatTrait<br>
- * </td>
- * <td valign="top" align="center">0.0f<br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" valign="top">x2<br>
- * </td>
- * <td valign="top">getFloatTrait<br>
- * </td>
- * <td valign="top">setFloatTrait<br>
- * </td>
- * <td valign="top" align="center">0.0f<br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" valign="top">y1<br>
- * </td>
- * <td valign="top">getFloatTrait<br>
- * </td>
- * <td valign="top">setFloatTrait<br>
- * </td>
- * <td valign="top" align="center">0.0f<br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" valign="top">y2<br>
- * </td>
- * <td valign="top">getFloatTrait<br>
- * </td>
- * <td valign="top">setFloatTrait<br>
- * </td>
- * <td valign="top" align="center">0.0f<br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" valign="top"><br>
- * </td>
- * <td valign="top"><br>
- * </td>
- * <td valign="top"><br>
- * </td>
- * <td valign="top"><br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" colspan="4" rowspan="1" bgcolor="#cccccc" valign="top"><path> (path-length is not supported)<br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" valign="top">d<br>
- * </td>
- * <td valign="top">getPathTrait [SVGPath]<br>
- * </td>
- * <td valign="top">setPathTrait [SVGPath]<br>
- * </td>
- * <td valign="top" align="center">REQUIRED<br>(Empty SVGPath)<br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" valign="top"><br>
- * </td>
- * <td valign="top"><br>
- * </td>
- * <td valign="top"><br>
- * </td>
- * <td valign="top"><br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" colspan="4" rowspan="1" bgcolor="#cccccc" valign="top"><image><br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" valign="top">x<br>
- * </td>
- * <td valign="top">getFloatTrait <br>
- * </td>
- * <td valign="top">setFloatTrait<br>
- * </td>
- * <td valign="top" align="center">0.0f<br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" valign="top">y<br>
- * </td>
- * <td valign="top">getFloatTrait<br>
- * </td>
- * <td valign="top">setFloatTrait<br>
- * </td>
- * <td valign="top" align="center">0.0f<br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" valign="top">width<br>
- * </td>
- * <td valign="top">getFloatTrait [value >= 0]<br>
- * </td>
- * <td valign="top">setFloatTrait [value >= 0]<br>
- * </td>
- * <td valign="top" align="center">REQUIRED<br>(0.0f)<br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" valign="top">height<br>
- * </td>
- * <td valign="top">getFloatTrait [value >= 0]<br>
- * </td>
- * <td valign="top">setFloatTrait [value >= 0]<br>
- * </td>
- * <td valign="top" align="center">REQUIRED<br>(0.0f)<br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" valign="top">xlink:href<br>
- * </td>
- * <td valign="top">getTrait NS[absolute URI]<br>
- * </td>
- * <td valign="top">setTraitNS [non local-URI value]<br>
- * </td>
- * <td valign="top" align="center">REQUIRED<br>( "" )<br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" valign="top"><br>
- * </td>
- * <td valign="top"><br>
- * </td>
- * <td valign="top"><br>
- * </td>
- * <td valign="top"><br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" colspan="4" rowspan="1" bgcolor="#cccccc" valign="top"><use><br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" valign="top">x<br>
- * </td>
- * <td valign="top">getFloatTrait<br>
- * </td>
- * <td valign="top">setFloatTrait<br>
- * </td>
- * <td valign="top" align="center">0.0f<br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" valign="top">y<br>
- * </td>
- * <td valign="top">getFloatTrait<br>
- * </td>
- * <td valign="top">setFloatTrait<br>
- * </td>
- * <td valign="top" align="center">0.0f<br>
- * </td>
- * </tr>
- * <tr>
- * <td valign="top">xlink:href<br>
- * </td>
- * <td valign="top">getTraitNS[absolute URI]<br>
- * </td>
- * <td valign="top">setTraitNS<br>
- * </td>
- * <td valign="top" align="center">""<br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" valign="top"><br>
- * </td>
- * <td valign="top"><br>
- * </td>
- * <td valign="top"><br>
- * </td>
- * <td valign="top"><br>
- * </td>
- * </tr>
- * <tr>
- * <tr>
- * <td width="150" colspan="4" rowspan="1" bgcolor="#cccccc" valign="top"><a><br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" valign="top">target<br>
- * </td>
- * <td valign="top">getTrait<br>
- * </td>
- * <td valign="top">setTrait<br>
- * </td>
- * <td valign="top" align="center">""<br>
- * </td>
- * </tr>
- * <tr>
- * <td valign="top">xlink:href<br>
- * </td>
- * <td valign="top">getTraitNS[absolute URI]<br>
- * </td>
- * <td valign="top">setTraitNS<br>
- * </td>
- * <td valign="top" align="center">""<br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" valign="top"><br>
- * </td>
- * <td valign="top"><br>
- * </td>
- * <td valign="top"><br>
- * </td>
- * <td valign="top"><br>
- * </td>
- * </tr>
- * <tr>
- * <td width="*" colspan="4" rowspan="1" bgcolor="#cccccc" valign="top"><text><br />(Notes:
- * For 'x' and 'y', it is only possible
- * to provide floating point scalar values; an array of x or y values is not supported. <br />
- * 'rotate' attribute is not supported.)<br/>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" valign="top">x<br>
- * </td>
- * <td valign="top">getFloatTrait<br>
- * </td>
- * <td valign="top">setFloatTrait<br>
- * </td>
- * <td valign="top" align="center">0.0f<br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" valign="top">y<br>
- * </td>
- * <td valign="top">getFloatTrait<br>
- * </td>
- * <td valign="top">setFloatTrait<br>
- * </td>
- * <td valign="top" align="center">0.0f<br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" valign="top">#text<br>
- * </td>
- * <td valign="top">getTrait [not null]<br>
- * </td>
- * <td valign="top">setTrait [not null]<br>
- * </td>
- * <td valign="top" align="center">""<br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" valign="top"><br>
- * </td>
- * <td valign="top"><br>
- * </td>
- * <td valign="top"><br>
- * </td>
- * <td valign="top"><br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" colspan="4" rowspan="1" bgcolor="#cccccc" valign="top"><svg><br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" valign="top">version<br>
- * </td>
- * <td valign="top">getTrait<br>
- * </td>
- * <td valign="top">Not available (readonly)<br>
- * </td>
- * <td valign="top" align="center">"1.1"<br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" valign="top">baseProfile<br>
- * </td>
- * <td valign="top">getTrait<br>
- * </td>
- * <td valign="top">Not available (readonly)<br>
- * </td>
- * <td valign="top" align="center">"tiny"<br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" valign="top">viewBox<br>
- * </td>
- * <td valign="top">getRectTrait [null, SVGRect]<br>
- * </td>
- * <td valign="top">setRectTrait [SVGRect]<br>
- * </td>
- * <td valign="top" align="center">null<br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" valign="top">zoomAndPan<br>
- * </td>
- * <td valign="top">getTrait [disable | magnify]<br>
- * </td>
- * <td valign="top">setTrait [disable | magnify]<br>
- * </td>
- * <td valign="top" align="center">"magnify"<br>
- * </td>
- * </tr>
- * <tr>
- * <td width="150" valign="top"><br>
- * </td>
- * <td valign="top"><br>
- * </td>
- * <td valign="top"><br>
- * </td>
- * <td valign="top"><br>
- * </td>
- * </tr>
- * </tbody>
- * </table>
- */
-
-public interface SVGElement extends Element, EventTarget
-{
-
- /**
- * Sets the Element's id attribute.
- * @param Id the value of Id to be set for this Element.
- * @throws DOMException with error code NO_MODIFICATION_ALLOWED_ERR is raised if an attempt is made to change an existing Id.
- * @throws DOMException with error code INVALID_ACCESS_ERR is raised if the Id is not unique i.e. if this Id already exists in the document.
- * @throws NullPointerException if <code>Id</code> is null.
- * @throws SecurityException if the application does not have the necessary privilege rights
- * to access this (SVG) content.
- */
- public void setId(String Id)
- throws DOMException;
-
- /**
- * Returns the Element's Id, null if no id specified.
- * @return the Element's Id.
- */
- public String getId();
-
- /**
- * Returns the first child element node of this element. <code>null</code> if this element has no child elements.
- * @return the first child element node of this element.
- */
- public Element getFirstElementChild();
-
- /**
- * Returns the next sibling element node of this element. <code>null</code> if this element has no element sibling
- * nodes that come after this one in the document tree.
- * @return the next sibling element node of this element.
- */
- public Element getNextElementSibling();
-
-
- /**
- * Returns the trait value as String. In SVG Tiny only certain traits can be obtained as a String value. Syntax of the
- * returned String matches the syntax of the corresponding attribute. This element is exactly equivalent to {@link org.w3c.dom.svg.SVGElement#getTraitNS getTraitNS}
- * with namespaceURI set to null.
- *
- * @param name the name of the trait to retrieve.
- * @return the trait value as String for the specified name.
- * @throws DOMException with error code NOT_SUPPORTED_ERR if the requested trait is not supported on this element or null.
- * @throws DOMException with error code TYPE_MISMATCH_ERR if requested trait's computed value cannot be converted to a String (SVG Tiny only).
- * @throws SecurityException if the application does not have the necessary privilege rights
- * to access this (SVG) content.
- */
- public String getTrait(String name)
- throws DOMException;
-
- /**
- * Same as {@link org.w3c.dom.svg.SVGElement#getTrait getTrait}, but for namespaced traits. Parameter name must be a non-qualified trait name, i.e. without prefix.
- *
- * @param namespaceURI the namespaceURI of the trait to retrieve.
- * @param name the name of the trait to retrieve.
- * @return the trait value as String for the specified name.
- * @throws DOMException with error code NOT_SUPPORTED_ERR if the requested trait is not supported on this element or null.
- * @throws DOMException with error code TYPE_MISMATCH_ERR if requested trait's computed value cannot be converted to a String (SVG Tiny only).
- * @throws SecurityException if the application does not have the necessary privilege rights
- * to access this (SVG) content.
- */
- public String getTraitNS(String namespaceURI, String name)
- throws DOMException;
-
- /**
- * Get the trait value as float.
- *
- * @param name the name of the trait to retrieve.
- * @return the trait value as float for the specified name.
- * @throws DOMException with error code NOT_SUPPORTED_ERR if the requested trait is not supported on this element or null.
- * @throws DOMException with error code TYPE_MISMATCH_ERR if requested trait's computed value cannot be converted to a float
- * @throws SecurityException if the application does not have the necessary privilege rights
- * to access this (SVG) content.
- */
- public float getFloatTrait(String name)
- throws DOMException;
-
- /**
- * Returns the trait value as {@link org.w3c.dom.svg.SVGMatrix SVGMatrix}. The returned object is a copy of the actual trait value and will not change if
- * the corresponding trait changes.
- *
- * @param name the name of the trait to retrieve.
- * @return the trait value as SVGMatrix for the specified name.
- * @throws DOMException with error code NOT_SUPPORTED_ERR if the requested trait is not supported on this element or null.
- * @throws DOMException with error code TYPE_MISMATCH_ERR if requested trait's computed value cannot be converted to {@link org.w3c.dom.svg.SVGMatrix SVGMatrix}
- * @throws SecurityException if the application does not have the necessary privilege rights
- * to access this (SVG) content.
- */
- public SVGMatrix getMatrixTrait(String name)
- throws DOMException;
-
- /**
- * Returns the trait value as {@link org.w3c.dom.svg.SVGRect SVGRect}. The returned object is a copy of the actual trait value and will not change if
- * the corresponding trait changes.
- *
- * @param name the name of the trait to retrieve.
- * @return the trait value as SVGRect for the specified name.
- * @throws DOMException with error code NOT_SUPPORTED_ERR if the requested trait is not supported on this element or null.
- * @throws DOMException with error code TYPE_MISMATCH_ERR if requested trait's computed value cannot be converted to {@link org.w3c.dom.svg.SVGRect SVGRect}
- * @throws SecurityException if the application does not have the necessary privilege rights
- * to access this (SVG) content.
- */
- public SVGRect getRectTrait(String name)
- throws DOMException;
-
- /**
- * Returns the trait value as {@link org.w3c.dom.svg.SVGPath SVGPath}. The returned object is a copy of the actual trait value and will not change if
- * the corresponding trait changes.
- *
- * @param name the name of the trait to retrieve.
- * @return the trait value as SVGPath for the specified name.
- * @throws DOMException with error code NOT_SUPPORTED_ERR if the requested trait is not supported on this element or null.
- * @throws DOMException with error code TYPE_MISMATCH_ERR if requested trait's computed value cannot be converted to {@link org.w3c.dom.svg.SVGPath SVGPath}
- * @throws SecurityException if the application does not have the necessary privilege rights
- * to access this (SVG) content.
- */
- public SVGPath getPathTrait(String name)
- throws DOMException;
-
- /**
- * Returns the trait value as {@link org.w3c.dom.svg.SVGRGBColor SVGRGBColor}. The returned object is a copy of the trait value and will not change if
- * the corresponding trait changes. If the actual trait value is not an RGBColor (i.e. "none"), this method will return null.
- *
- * @param name the name of the trait to retrieve.
- * @return the trait value as SVGRGBColor for the specified name.
- * @throws DOMException with error code NOT_SUPPORTED_ERR if the requested trait is not supported on this element or null.
- * @throws DOMException with error code TYPE_MISMATCH_ERR if requested trait's computed value cannot be converted to {@link org.w3c.dom.svg.SVGRGBColor SVGRGBColor}
- * @throws SecurityException if the application does not have the necessary privilege rights
- * to access this (SVG) content.
- */
- public SVGRGBColor getRGBColorTrait(String name)
- throws DOMException;
-
- /**
- * Set the trait value as String. In SVG Tiny only certain traits can be set through a String value. The syntax of the String
- * that should be given as a value must be the same as syntax of the corresponding XML attribute value. Exactly equivalent
- * to {@link org.w3c.dom.svg.SVGElement#setTraitNS setTraitNS} with namespaceURI attribute set to null.
- *
- * @param name the name of the trait to be set.
- * @param value the value of the trait to be set as String.
- * @throws DOMException with error code NOT_SUPPORTED_ERR if the requested trait is not supported on this element or null.
- * @throws DOMException with error code TYPE_MISMATCH_ERR if the requested trait's value cannot be specified as a String
- * @throws DOMException with error code INVALID_ACCESS_ERR if the input value is an invalid value for the given trait or null.
- * @throws DOMException with error code NO_MODIFICATION_ALLOWED_ERR: if attempt is made to change readonly trait.
- * @throws SecurityException if the application does not have the necessary privilege rights
- * to access this (SVG) content.
- */
- public void setTrait(String name, String value)
- throws DOMException;
-
- /**
- * Same as {@link org.w3c.dom.svg.SVGElement#setTrait setTrait}, but for namespaced traits. Parameter name must be a non-qualified trait name, i.e. without prefix.
- *
- * @param namespaceURI the namespaceURI of the trait to be set.
- * @param name the name of the trait to be set.
- * @param value the value of the trait to be set as String.
- * @throws DOMException with error code NOT_SUPPORTED_ERR if the requested trait is not supported on this element or null.
- * @throws DOMException with error code TYPE_MISMATCH_ERR if the requested trait's value cannot be specified as a String
- * @throws DOMException with error code INVALID_ACCESS_ERR if the input value is an invalid value for the given trait or null.
- * This error is also thrown when the <use> element is hooked into the document tree and the the value of xlink:href is set invalid.
- * @throws DOMException with error code NO_MODIFICATION_ALLOWED_ERR: if attempt is made to change readonly trait.
- * @throws SecurityException if the application does not have the necessary privilege rights
- * to access this (SVG) content.
- */
-
- public void setTraitNS(String namespaceURI, String name, String value)
- throws DOMException;
-
- /**
- * Set the trait value as float.
- *
- * @param name the name of the trait to be set.
- * @param value the value of the trait to be set as float.
- * @throws DOMException with error code NOT_SUPPORTED_ERR if the requested trait is not supported on this element.
- * @throws DOMException with error code TYPE_MISMATCH_ERR if the requested trait's value cannot be specified as a float
- * @throws DOMException with error code INVALID_ACCESS_ERR if the input value is an invalid value for the given trait.
- * @throws SecurityException if the application does not have the necessary privilege rights
- * to access this (SVG) content.
- */
- public void setFloatTrait(String name, float value)
- throws DOMException;
-
- /**
- * Set the trait value as {@link org.w3c.dom.svg.SVGMatrix SVGMatrix}. Values in SVGMatrix are copied in the trait so subsequent changes to the given
- * SVGMatrix have no effect on the value of the trait.
- *
- * @param name the name of the trait to be set.
- * @param matrix the value of the trait to be set as SVGMatrix.
- * @throws DOMException with error code NOT_SUPPORTED_ERR if the requested trait is not supported on this element or null.
- * @throws DOMException with error code TYPE_MISMATCH_ERR if the requested trait's value cannot be specified as an {@link org.w3c.dom.svg.SVGMatrix SVGMatrix}
- * @throws DOMException with error code INVALID_ACCESS_ERR if the input matrix value is null.
- * @throws SecurityException if the application does not have the necessary privilege rights
- * to access this (SVG) content.
- */
-
- public void setMatrixTrait(String name, SVGMatrix matrix)
- throws DOMException;
-
- /**
- * Set the trait value as {@link org.w3c.dom.svg.SVGRect SVGRect}. Values in SVGRect are copied in the trait so subsequent changes to the given
- * SVGRect have no effect on the value of the trait.
- *
- * @param name the name of the trait to be set.
- * @param rect the value of the trait to be set as SVGRect.
- * @throws DOMException with error code NOT_SUPPORTED_ERR if the requested trait is not supported on this element or null.
- * @throws DOMException with error code TYPE_MISMATCH_ERR if the requested trait's value cannot be specified as an {@link org.w3c.dom.svg.SVGRect SVGRect}
- * @throws DOMException with error code INVALID_ACCESS_ERR if the input value is an invalid value for the given trait or null.
- * SVGRect is invalid if the width or height values are set to negative.
- * @throws SecurityException if the application does not have the necessary privilege rights
- * to access this (SVG) content.
- */
-
- public void setRectTrait(String name, SVGRect rect)
- throws DOMException;
-
- /**
- * Set the trait value as {@link org.w3c.dom.svg.SVGPath SVGPath}. Values in SVGPath are copied in the trait so subsequent changes to the given
- * SVGPath have no effect on the value of the trait.
- *
- * @param name the name of the trait to be set.
- * @param path the value of the trait to be set as SVGPath.
- * @throws DOMException with error code NOT_SUPPORTED_ERR if the requested trait is not supported on this element or null.
- * @throws DOMException with error code TYPE_MISMATCH_ERR if the requested trait's value cannot be specified as an {@link org.w3c.dom.svg.SVGPath SVGPath}
- * @throws DOMException with error code INVALID_ACCESS_ERR if the input value is an invalid value for the given trait or null.
- * SVGPath is invalid if it begins with any segment other than MOVE_TO segment. Note that an empty SVGPath is still a valid value.
- * @throws SecurityException if the application does not have the necessary privilege rights
- * to access this (SVG) content.
- */
-
- public void setPathTrait(String name, SVGPath path)
- throws DOMException;
-
- /**
- * Set the trait value as {@link org.w3c.dom.svg.SVGRGBColor SVGRGBColor}. Values in SVGRGBColor are copied in the trait so subsequent changes to the given
- * SVGRGBColor have no effect on the value of the trait.
- *
- * @param name the name of the trait to be set.
- * @param color the value of the trait to be set as SVGRGBColor.
- * @throws DOMException with error code NOT_SUPPORTED_ERR if the requested trait is not supported on this element or null.
- * @throws DOMException with error code TYPE_MISMATCH_ERR if the requested trait's value cannot be specified as an {@link org.w3c.dom.svg.SVGRGBColor SVGRGBColor}
- * @throws DOMException with error code INVALID_ACCESS_ERR if the input value is null.
- * @throws SecurityException if the application does not have the necessary privilege rights
- * to access this (SVG) content.
- */
-
- public void setRGBColorTrait(String name, SVGRGBColor color)
- throws DOMException;
-}
--- a/javauis/m2g_qt/javasrc/org/w3c/dom/svg/SVGException.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-package org.w3c.dom.svg;
-
-
-/**
- * An exception thrown for SVG-specific errors, such as noninvertable matrix in {@link org.w3c.dom.svg.SVGMatrix#inverse inverse}.
- */
-public class SVGException extends RuntimeException
-{
- /**
- * An integer indicating the type of error generated.
- */
- public short code;
-
- /**
- * Constructs a SVGException with a detailed message.
- *
- * @param code the exception's error code.
- * @param message the exception's descriptive message.
- */
- public SVGException(short code, String message)
- {
- super(message);
- this.code = code;
- }
-
-
- /**
- * Value passed to an SVG-specific method is invalid, such as out of range color component in {@link org.w3c.dom.svg.SVGSVGElement#createSVGRGBColor createSVGRGBColor}.
- */
- public static final short SVG_INVALID_VALUE_ERR = 1;
-
- /**
- * Matrix that has a determinant equal to zero, and therefore not invertable.
- */
- public static final short SVG_MATRIX_NOT_INVERTABLE = 2;
-
-}
--- a/javauis/m2g_qt/javasrc/org/w3c/dom/svg/SVGLocatableElement.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,277 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-package org.w3c.dom.svg;
-
-
-/**
- * This interface represents an SVGLocatableElement. It is implemented by all drawable SVG elements
- * in the document tree. Drawable elements are: <rect>, <circle>, <ellipse>,
- * <line>, <path> <use> <image> <text>, <svg>, <a>,
- * and <g>. <b>Note</b> that animations will have an effect on the values of bounding box.
- *
- * <br>
- * <br>
- * <br>
- *The following example further clarify the behavior of the getBBox()
- *method. The example have a short explanation, an SVG fragment and are
- *followed by a set of bounding box values which have the following
- *format:<br>
- *<tt><br>
- *[elementId] : {x, y, width, height} | {null}</tt><br>
- *<br>
- *where x, y, width and height define the values of the SVGRect object's
- *returned from a getBBox call on the element with the specified id.
- *There are a few cases where the bounding box may be null (see example
- *6).<br>
- *<br>
- *<h3>Example #1: Simple groups and bounds</h3>
- *<br>
- *This first example shows the values returned by the getBBox method for
- *various simple basic shapes and groups. In particular, it shows that
- *the transform, on an element, does not change the value of its user
- *space bounding box.<br>
- *<br>
- *<tt><g id="group1" transform="translate(10, 20)" fill="red" >
- *<br>
- * <rect id="rect1" transform="scale(2)" x="10" y="10" width="50"
- *height="50"/>
- *<br>
- * <rect id="rect2" x="10" y="10" width="100" height="100"/>
- *<br>
- * <g id="group2" transform="translate(10, 20)" >
- *<br>
- * <rect id="rect3" x="0" y="10" width="150" height="50"/>
- *<br>
- * <circle id="circle1" cx="20" cy="20" r="100" />
- *<br>
- * </g>
- *<br>
- *</g>
- *<br>
- *</tt><br>
- *<tt>[group1] : {-70.0, -60.0, 230.0, 200.0}
- *<br>
- *[rect1] : {10.0, 10.0, 50.0, 50.0}
- *<br>
- *[rect2] : {10.0, 10.0, 100.0, 100.0}
- *<br>
- *[group2] : {-80.0, -80.0, 230.0, 200.0}
- *<br>
- *[rect3] : {0.0, 10.0, 150.0, 50.0}
- *<br>
- *[circle1] : {-80.0, -80.0, 200.0, 200.0}
- *</tt><br>
- *<br>
- *<h3>Example #2: Bounding box on zero width or height rectangle<br>
- *</h3>
- *This example illustrates that the bounding box on elements is based on
- *the element's geometry coordinates. For example, the bounding box on a
- *zero-width rectangle is defined (see below), even though the rectangle
- *is not rendered.<br>
- *<pre><tt><g id="group1" transform="translate(10, 20)" fill="red" ></tt></pre>
- *<pre><tt> </tt><rect id="rect2" x="10" y="10" width="400" height="0"/></pre>
- *<pre wrap=""><tt> <g id="group2" transform="translate(10, 20)" >
- * <rect id="rect3" x="0" y="10" width="150" height="50"/>
- * </g></tt><tt>
- *</g>
- *</tt></pre>
- *<pre><tt>[group1] : {10.0, 10.0, 400.0, 70.0}
- *</tt>[rect2] : {10.0, 10.0, 400.0, 0.0}<tt>
- *</tt>[group2] : {0.0, 10.0, 150.0, 50.0}<tt>
- *[rect3] : {0.0, 10.0, 150.0, 50.0}</tt>
- *</pre>
- *<h3>Example #3: Bounding Box on zero radius ellipses.</h3>
- *This is another example of how bounding boxes are based on the
- *element's geometry. Here, the bounding box of an ellipse with a zero
- *x-axis radius is still defined, even though the ellipse is not rendered.<br>
- *<pre wrap=""><svg id="mySVG" width="10" height="20">
- *<g id="group1" transform="translate(10, 20)" fill="red" >
- * <rect id="rect1" x="10" y="10" width="100" height="100"/>
- * <ellipse id="ellipse1" cx="20" cy="20" rx="0" ry="70" />
- *</g></pre>
- *<tt>[mySVG] : {20.0, -30.0, 100.0, 160.0}
- *<br>
- *[group1] : {10.0, -50.0, 100.0, 160.0}
- *<br>
- *[rect1] : {10.0, 10.0, 100.0, 100.0}
- *<br>
- *[ellipse1] : {20.0, -50.0, 0.0, 140.0}
- *</tt><br>
- *<h3>Example #4: Viewports do not clip bounding boxes</h3>
- *This example shows that no matter what the viewport is on the root SVG
- *element, the bounding boxes, based on the geometry, are still defined.
- *Here, even though the root svg has a zero width, the bounding boxes for
- *the root itself and its children is precisely defined.<br>
- *<pre wrap=""><svg id="mySVG" width="0" height="50">
- * <g id="group1" transform="translate(10, 20)" fill="red" >
- * <rect id="rect1" x="10" y="10" width="50" height="50"/>
- * <g id="group2" transform="translate(10, 20)" >
- * <rect id="rect2" x="0" y="10" width="150" height="0"/>
- * <circle id="circle1" cx="20" cy="20" r="500" />
- * </g>
- * </g>
- *</svg>
- *</pre>
- *<tt>[mySVG] : {-460.0, -440.0, 1000.0, 1000.0}
- *<br>
- *[group1] : {-470.0, -460.0, 1000.0, 1000.0}
- *<br>
- *[rect1] : {10.0, 10.0, 50.0, 50.0}
- *<br>
- *[group2] : {-480.0, -480.0, 1000.0, 1000.0}
- *<br>
- *[rect2] : {0.0, 10.0, 150.0, 0.0}
- *<br>
- *[circle1] : {-480.0, -480.0, 1000.0, 1000.0}
- *</tt><br>
- *<h3>Example #5: getBBox on <use></h3>
- *This example shows that the bounding box for a <use> element
- *accounts for the x and y attributes defined on the element, just like
- *the x and y attributes impact the bounding box computation on a
- *<rect> or on an <image> element.<br>
- *<br>
- *<tt><svg>
- *<br>
- * <defs>
- *<br>
- * <rect id="myRect" x="0" y="0" width="60" height="40" />
- *<br>
- * </defs>
- *<br>
- * <use id="myUse" xlink:href="#myRect" x="-30" y="-20" />
- *<br>
- *</svg>
- *<br>
- *</tt>
- *<br>
- *<tt>[myRect] : {0.0, 0.0, 60.0, 40.0}
- *<br>
- *[myUse] : {-30.0, -20.0, 60.0, 40.0}
- *</tt><br>
- *<h3>Example #6: Empty group</h3>
- *This example shows that the bounding box for an empty group is null. By
- *the same token, the bounding box of a <path> with an empty
- *SVGPath (i.e., one with no path commands, which may happen after
- *creating a new <path> element with a Document.createElementNS
- *call) is also null.<br>
- *<br>
- *<tt><g id="emptyG" />
- *<br>
- *<br>
- *[emptyG] : {null}
- *</tt><br>
- *<br>
- *<h3>Example #7: Impact of display='none' and visibility='hidden'<br>
- *</h3>
- *This example shows how the bounding box of children with display='none'
- *are not accounted for in the computation of their parent's bounding
- *box. This reflects the definition of the display property and its
- *impact on rendering and bounding box computation. The example also
- *shows that elements with a 'hidden' visibility still contribute to
- *their parent's bounding box computation.<br>
- *<br>
- *<tt><g id="g1"> <br>
- * <g id="g1.1.display.none" display="none"> <br>
- * <rect id="rect1" x="10" y="10" width="40" height="40"/><br>
- * <g/>
- *<br>
- * <rect id="rect2.visibility.hidden" visibility="hidden" <br>
- * x="30" y="60" width="10" height="20"/>
- *<br>
- *</g></tt><br>
- *<br>
- *<tt>[g1] : {30.0, 60.0, 10.0, 20.0} <br>
- *[g1.1.display.none] : {10.0, 10.0, 40.0, 40.0}<br>
- *[rect1] : {10.0, 10.0, 40.0, 40.0}<br>
- *[rec2.visibility.hidden] : {30.0, 60.0, 10.0, 20.0}</tt><br>
- *<h3>Example #8: Concatenating bounding boxes in the container's user
- *space.<br>
- *</h3>
- *This example shows how the concatenation and computation of bounding
- *boxes for container element happens in the container's user space.<br>
- *<br>
- *<tt><g id="g1"><br>
- * <line id="line1" x2="100" y2="100" transform="rotate(-45)"/><br>
- *</g></tt><br>
- *<tt><br>
- *[g1] : {0.0, 0.0, 141.42136, 0}<br>
- *[line1] : {0.0, 0.0, 100.0, 100.0}</tt><br>
- *<h3>Example #9: No influence of stroke-width.</h3>
- *This example illustrates that stroking has no impact on the computation
- *of bounding boxes.<br>
- *<tt><br>
- *<g><br>
- * <line id="thickLine" stroke-width="10" x2="100" y2="0" /><br>
- *</g></tt><br>
- *<br>
- *[thickLine] : {0.0, 0.0, 100.0, 0.0}<br>
- *<br>
- *<h3>Example #10: No influence of viewBox.</h3>
- *This example illustrates that viewBox has no impact on the computation
- *of bounding boxes.<br>
- *<tt><br>
- *<svg id="rootSvg" width="500" height="300" viewBox="0 0 200 100" ><br>
- * <rect x="-100" y="-200" width="500" height="100" /><br>
- *</svg></tt><br>
- *<br>
- *[rootSVG] : {-100, -200, 500, 100}<br>
- *
- *
- */
-public interface SVGLocatableElement extends SVGElement
-{
-
- /**
- * <p>
- * Returns the tight bounding box in current user coordinate space. Tight bounding box is the smallest
- * possible rectangle that includes the geometry of all contained graphics elements excluding stroke.
- * The calculation is done in the user coordinate space of the element. When bounding box
- * is calculated elements with display property (trait) set to none are ignored. Exact rules for the bounding
- * box calculation are given in the <a href="http://www.w3.org/TR/SVG/coords.html#ObjectBoundingBox">SVG spec</a>.
- * </p>
- *
- * @return the tight bounding box in current user coordinate space.
- */
- public SVGRect getBBox();
-
- /**
- * <p>
- * Returns the transformation matrix from current user units (i.e., after application of the transform attribute, if any)
- * to the parent user agent's notion of a "pixel". For display devices, ideally this represents a physical screen pixel.
- * For other devices or environments where physical pixel sizes are not known, then an algorithm similar to the CSS2
- * definition of a "pixel" can be used instead. Note that <code>null</code> is returned if this element is not hooked into the
- * document tree.
- * </p>
- *
- * @return the transformation matrix from current user units to the parent user agent's notion of a "pixel".
- */
- public SVGMatrix getScreenCTM();
-
- /**
- * <p>
- * Returns the tight bounding box in screen coordinate space. Tight bounding box is the smallest
- * possible rectangle that includes the geometry of all contained graphics elements excluding stroke.
- * The box coordinates are in the screen coordinate space, which is connected to the current user
- * coordinate space by the matrix returned by {@link org.w3c.dom.svg.SVGLocatableElement#getScreenCTM getScreenCTM} method.
- * Note that <code>null</code> is returned if this element is not hooked into the
- * document tree.
- * </p>
- *
- * @return the tight bounding box in screen coordinate space.
- */
- public SVGRect getScreenBBox();
-}
\ No newline at end of file
--- a/javauis/m2g_qt/javasrc/org/w3c/dom/svg/SVGMatrix.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,129 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-package org.w3c.dom.svg;
-
-import org.w3c.dom.svg.SVGException;
-import org.w3c.dom.DOMException;
-
-/**
- * This interface represents an "SVGMatrix" datatype, identified by an affine transform.
- * It can be used to read and modify the values of transform attribute as per SVG specification.
- * Note that the mTranslate, mMultiply, mScale and mRotate methods in this interface
- * mutate the SVGMatrix object and return a reference to the SVGMatrix instance itself, after
- * performing the necessary matrix operation.
- * <p>This matrix transforms source coordinates (x, y) into destination coordinates (x', y') by
- * considering them to be a column vector and multiplying the coordinate vector by the matrix
- * according to the following process:</p>
- *
- * <p>
- * <pre>
- * [ x' ] [ a c e ] [ x ] [ a.x + c.y + e ]
- * [ y' ] = [ b d f ] [ y ] = [ b.x + d.y + f ]
- * [ 1 ] [ 0 0 1 ] [ 1 ] [ 1 ]
- * </pre>
- * </p>
- */
-public interface SVGMatrix
-{
-
- /**
- * Returns a component of the matrix by component's zero-based index. <code>getComponent(0)</code> is a, <code>getComponent(1)</code> is b, etc.
- *
- * @param index the index of the matrix component to retrieve.
- * @return the component for the specified index.
- * @throws DOMException - INDEX_SIZE_ERR if the <code>index</code> is invalid.
- */
- public float getComponent(int index)
- throws DOMException;
-
- /**
- * Performs matrix multiplication. This matrix is post-multiplied by another matrix, returning the resulting current matrix.
- *
- * @param secondMatrix the matrix to post-multiply with.
- * @return the resulting current matrix after post-multiplication.
- * @throws NullPointerException - if secondMatrix is null.
- */
- public SVGMatrix mMultiply(SVGMatrix secondMatrix);
-
- /**
- * Returns a new instance of SVGMatrix containing the inverse of the current matrix.
- *
- * @return the inverse of the current matrix.
- * @throws SVGException - SVG_MATRIX_NOT_INVERTABLE when determinant of this matrix is zero.
- */
- public SVGMatrix inverse()
- throws SVGException;
-
- /**
- * Post-multiplies a translation transformation on the current matrix and returns the resulting current matrix.
- * This is equivalent to calling <code>multiply(T)</code>, where <code>T</code> is an
- * <code>SVGMatrix</code> object represented by the following
- * matrix:
- *
- * <p>
- * <pre>
- * [ 1 0 x ]
- * [ 0 1 y ]
- * [ 0 0 1 ]
- * </pre>
- * </p>
- *
- * @param x the distance by which coordinates are translated
- * in the X axis direction.
- * @param y the distance by which coordinates are translated
- * in the Y axis direction.
- * @return the resulting current matrix after post-multiplication.
- */
- public SVGMatrix mTranslate(float x, float y);
-
- /**
- * Post-multiplies a uniform scale transformation on the current matrix and returns the resulting current matrix.
- * This is equivalent to calling <code>multiply(S)</code>, where <code>S</code> is an <code>SVGMatrix</code>
- * object represented by the following matrix:
- *
- * <p>
- * <pre>
- * [ scaleFactor 0 0 ]
- * [ 0 scaleFactor 0 ]
- * [ 0 0 1 ]
- * </pre>
- * </p>
- *
- * @param scaleFactor the factor by which coordinates are scaled along the
- * X and Y axis.
- * @return the resulting current matrix after post-mutiplication.
- */
- public SVGMatrix mScale(float scaleFactor);
-
- /**
- * Post-multiplies a rotation transformation on the current matrix and returns the resulting current matrix.
- * This is equivalent to calling <code>multiply(R)</code>, where <code>R</code> is an
- * <code>SVGMatrix</code> object represented by the following matrix:
- *
- * <p>
- * <pre>
- * [ cos(angle) -sin(angle) 0 ]
- * [ sin(angle) cos(angle) 0 ]
- * [ 0 0 1 ]
- * </pre>
- * </p>
- *
- * @param angle the angle of rotation in degrees.
- * @return the resulting current matrix after post-multiplication.
- */
- public SVGMatrix mRotate(float angle);
-}
--- a/javauis/m2g_qt/javasrc/org/w3c/dom/svg/SVGPath.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,139 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-package org.w3c.dom.svg;
-import org.w3c.dom.DOMException;
-
-
-/**
- * This interface represents an "SVGPath" datatype used to define the path geometry.
- * Corresponds to SVG path specification or the "d" attribute.
- *
- *
- * <p>The native implementations must support the following simplifications or
- * canonicalization of path segments. Any simplifications should be lossless.
- *
- * <ul>
- * <li>Relative commands (c, h, l, m, q, s, t, and v) must be converted to their absolute counterparts·</li>
- * <li>Horizontal and Vertical lines (H, h, V, and v) must be converted to general lines (L and l)·</li>
- * <li>Translate command S to command C·</li>
- * <li>Translate command T to command Q.</li>
- * </ul>
- * </p>
- */
-public interface SVGPath
-{
-
- /**
- * Numeric value is ASCII code of the letter 'M'.
- */
- public static final short MOVE_TO = 77;
-
- /**
- * Numeric value is ASCII code of the letter 'L'.
- */
- public static final short LINE_TO = 76;
-
- /**
- * Numeric value is ASCII code of the letter 'C'.
- */
- public static final short CURVE_TO = 67;
-
- /**
- * Numeric value is ASCII code of the letter 'Q'.
- */
- public static final short QUAD_TO = 81;
-
- /**
- * Numeric value is ASCII code of the letter 'Z'.
- */
- public static final short CLOSE = 90;
-
-
- /**
- * Return number of segments in this path.
- *
- * @return the number of segments in this path.
- */
- public int getNumberOfSegments();
-
- /**
- * Returns segment command by zero-based command index. Returns one of MOVE_TO, LINE_TO, CURVE_TO, QUAD_TO or CLOSE.
- *
- * @param cmdIndex the command index for the segment command to retrieve.
- * @return the segment command for the specified cmdIndex.
- * @throws DOMException with error code INDEX_SIZE_ERR if segment index out of bounds.
- *
- */
- public short getSegment(int cmdIndex)
- throws DOMException;
-
- /**
- * Returns segment parameter by zero-based command index and zero-based parametr index.
- *
- * @param cmdIndex the command index for the segment parameter to retrieve.
- * @param paramIndex the parameter index for the segment parameter to retrieve.
- * @return the segment parameter for the specified cmdIndex and paramIndex.
- * @throws DOMException with error code INDEX_SIZE_ERR if segment index out of bounds or param index out of bounds for this segment's type.
- */
- public float getSegmentParam(int cmdIndex, int paramIndex)
- throws DOMException;
-
- /**
- * Appends 'M' (absolute move) segment to the path with the specified coordinates.
- *
- * @param x the x-axis coordinate for the specified point.
- * @param y the y-axis coordinate for the specified point.
- */
- public void moveTo(float x, float y);
-
- /**
- * Appends 'L' (absolute line) segment to the path with the specified coordinates.
- *
- * @param x the x-axis coordinate of the specified point.
- * @param y the y-axis coordinate of the specified point.
- */
- public void lineTo(float x, float y);
-
- /**
- * Appends 'Q' (absolute quadratic curve) segment to the path.
- *
- * @param x1 the x-axis coordinate of the first control point.
- * @param y1 the y-axis coordinate of the first control point.
- * @param x2 the x-axis coordinate of the final end point.
- * @param y2 the y-axis coordinate of the final end point.
- *
- */
- public void quadTo(float x1, float y1, float x2, float y2);
-
- /**
- * Appends 'C' (absolute cubic curve) segment to the path.
- *
- * @param x1 the x-axis coordinate of the first control point.
- * @param y1 the y-axis coordinate of the first control point.
- * @param x2 the x-axis coordinate of the second end point.
- * @param y2 the y-axis coordinate of the second end point.
- * @param x3 the x-axis coordinate of the final end point.
- * @param y3 the y-axis coordinate of the final end point.
- *
- */
- public void curveTo(float x1, float y1, float x2, float y2, float x3, float y3);
-
- /**
- * Appends 'Z' (close path) segment to the path
- */
- public void close();
-}
--- a/javauis/m2g_qt/javasrc/org/w3c/dom/svg/SVGPoint.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-package org.w3c.dom.svg;
-
-
-/**
- * This interface represents an "SVGPoint" datatype, identifiend by its x and y components.
- */
-public interface SVGPoint
-{
-
- /**
- * Sets the x component of the point to the specified float value.
- *
- * @param value the x component value
- *
- */
-
- public void setX(float value);
-
- /**
- * Sets the y component of the point to the specified float value.
- *
- * @param value the y component value
- *
- */
-
- public void setY(float value);
-
-
- /**
- * Returns the x component of the point.
- *
- * @return the x component of the point.
- *
- */
-
- public float getX();
-
- /**
- * Returns the y component of the point.
- *
- * @return the y component of the point.
- *
- */
- public float getY();
-}
--- a/javauis/m2g_qt/javasrc/org/w3c/dom/svg/SVGRGBColor.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-package org.w3c.dom.svg;
-
-
-/**
- * This interface represents an "SVGRGBColor" datatype made up of red, green, and blue components.
- * It can be used to read properties that store color values ({@link org.w3c.dom.svg.SVGElement#getRGBColorTrait getRGBColorTrait})
- * such as <code>fill</code>, <code>stroke</code>, and <code>color</code>.
- */
-public interface SVGRGBColor
-{
-
- /**
- * Returns the red component of the SVGRGBColor.
- *
- * @return the red component.
- *
- */
- public int getRed();
-
- /**
- * Returns the green component of the SVGRGBColor.
- *
- * @return the green component.
- *
- */
- public int getGreen();
-
- /**
- * Returns the blue component of the SVGRGBColor.
- *
- * @return the blue component.
- *
- */
- public int getBlue();
-
-}
--- a/javauis/m2g_qt/javasrc/org/w3c/dom/svg/SVGRect.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-package org.w3c.dom.svg;
-
-
-/**
- * This interface represents an "SVGRect" datatype, consisting of a minimum X, minimum Y, width
- * and height values.
- */
-public interface SVGRect
-{
-
- /**
- * Sets the minimum X value of this SVGRect to the specified value.
- *
- * @param value the minimum X value.
- *
- */
- public void setX(float value);
-
- /**
- * Sets the minimum Y value of this SVGRect to the specified value.
- *
- * @param value the minimum Y value.
- *
- */
- public void setY(float value);
-
- /**
- * Sets the width of this SVGRect to the specified value.
- *
- * @param value the rectangle width value.
- *
- */
- public void setWidth(float value);
-
- /**
- * Sets the height of this SVGRect to the specified value.
- *
- * @param value the rectangle height value.
- *
- */
- public void setHeight(float value);
-
- /**
- * Returns the minimum X value for this SVGRect.
- *
- * @return the minimum X value.
- *
- */
- public float getX();
-
- /**
- * Returns the minimum Y value for this SVGRect.
- *
- * @return the minimum Y value.
- *
- */
- public float getY();
-
-
- /**
- * Returns the width for this SVGRect.
- *
- * @return the rectangle width.
- *
- */
- public float getWidth();
-
- /**
- * Returns the height for this SVGRect.
- *
- * @return the rectangle height.
- *
- */
- public float getHeight();
-
-}
--- a/javauis/m2g_qt/javasrc/org/w3c/dom/svg/SVGSVGElement.java Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,162 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-package org.w3c.dom.svg;
-
-import org.w3c.dom.DOMException;
-
-/**
- * <p>This interface represents <svg> element in (SVG) document tree.</p>
- * <h4>User Agent Transforms</h4>
- * <p>
- * The DOM attributes currentScale, currentRotate and currentTranslate are combined to form user agent transformation
- * which is applied at the outermost level on the SVG document (i.e., outside the outermost 'svg' element) if "magnification"
- * is enabled (i.e., zoomAndPan attribute is set to "magnify"). Their values
- * can potentialy be modified through user-agent specific UI. User agent transformation can be obtained
- * by multiplying matrix
- * <p>
- * <pre>
- * [currentScale 0 currentTranslate.x] [cos(currentRotate) -sin(currentRotate 0]
- * [ 0 currentScale currentTranslate.y] by [sin(currentRotate) cos(currentRotate) 0]
- * [ 0 0 1 ] [ 0 0 1]
- * </pre>
- * </p>
- *
- * i.e. (translate, then scale, then rotate the coordinate system). The reference point for scale and rotate operations is the origin (0, 0).
- * </p>
- *
- * <p><b>Note:</b> If the application does not have the necessary privilege rights to access this (SVG)
- * content, a SecurityException may be thrown by the underlying implementation. This is applicable
- * to all the Tree navigation and Trait acessor methods. Features such as zooming, panning and
- * playing of animations will not be affected.
- * </p>
- */
-public interface SVGSVGElement extends SVGLocatableElement
-{
- /**
- * Sets current user agent scale (zoom) coefficient.
- *
- * @param value the value of user agent scale coefficient to be set.
- * @throws DOMException with error code INVALID_ACCESS_ERR if the scale value is set to zero.
- */
- public void setCurrentScale(float value)
- throws DOMException;
-
- /**
- * Returns current user agent scale (zoom) coefficient. The initial value for currentScale is 1.
- *
- * @return the current user agent scale coefficient.
- */
- public float getCurrentScale();
-
- /**
- * Sets current user agent rotate coefficient in degrees.
- *
- * @param value the value of user agent rotate coefficient to be set.
- */
- public void setCurrentRotate(float value);
-
- /**
- * Returns current user agent rotation angle in degrees. The initial value for currentRotate is 0.
- *
- * @return the current user agent rotation coefficient in degrees.
- */
- public float getCurrentRotate();
-
- /**
- * Current user agent translation used for scrolling or panning (The returned {@link org.w3c.dom.svg.SVGPoint SVGPoint} object is "live" and setting its
- * x and y components will change user agent's translation). The initial values for currentTranslate is SVGPoint(0,0).
- *
- * @return returns the current user agent translation.
- */
- public SVGPoint getCurrentTranslate();
-
- /**
- * Returns current animation timeline time in seconds.
- *
- * @return the current animation timeline time in seconds.
- */
- public float getCurrentTime();
-
- /**
- * Sets current animation timeline time (in seconds). This API is required to support moving
- * forwards in timeline. The underlying implementations are normally designed to seek
- * forward in time and setting the time backwards is not meant to play the animation backwards.
- * Note: Moving backwards in time is a costly feature for the implementations to support.
- *
- * @param seconds the value of time to be set in seconds.
- */
-
- public void setCurrentTime(float seconds);
-
- /**
- * Creates new {@link org.w3c.dom.svg.SVGMatrix SVGMatrix} object. This object can be used to modify value of traits which are compatible with {@link org.w3c.dom.svg.SVGMatrix SVGMatrix}
- * type using {@link org.w3c.dom.svg.SVGElement#setMatrixTrait setMatrixTrait} method. The internal representation of the matrix is as follows:
- * <p>
- * <pre>
- * [ a c e ]
- * [ b d f ]
- * [ 0 0 1 ]
- * </pre>
- * </p>
- *
- * @param a the 'a' component of the matrix to be set.
- * @param b the 'b' component of the matrix to be set.
- * @param c the 'c' component of the matrix to be set.
- * @param d the 'd' component of the matrix to be set.
- * @param e the 'e' component of the matrix to be set.
- * @param f the 'f' component of the matrix to be set.
- *
- * @return the newly created SVGMatrix object.
- *
- * @see org.w3c.dom.svg.SVGMatrix
- */
-
- public SVGMatrix createSVGMatrixComponents(float a, float b, float c, float d, float e, float f);
-
- /**
- * Creates new {@link org.w3c.dom.svg.SVGRect SVGRect} object. This object can be used to modify value of traits which are compatible with {@link org.w3c.dom.svg.SVGRect SVGRect}
- * type using {@link org.w3c.dom.svg.SVGElement#setRectTrait setRectTrait} method. The intial values for x, y, width, height of this new SVGRect are zero.
- *
- * @return the newly created SVGRect object.
- */
-
- public SVGRect createSVGRect();
-
- /**
- * Creates new {@link org.w3c.dom.svg.SVGPath SVGPath} object. This object can be used to modify value of traits which are compatible with {@link org.w3c.dom.svg.SVGPath SVGPath}
- * type using {@link org.w3c.dom.svg.SVGElement#setPathTrait setPathTrait} method.
- *
- * @return the newly created SVGPath object with empty path commands.
- */
-
- public SVGPath createSVGPath();
-
- /**
- * Creates new {@link org.w3c.dom.svg.SVGRGBColor SVGRGBColor} object. This object can be used to modify value of traits which are compatible with {@link org.w3c.dom.svg.SVGRGBColor SVGRGBColor}
- * type using {@link org.w3c.dom.svg.SVGElement#setRGBColorTrait setRGBColorTrait} method.
- *
- * @param red the red component of SVGRGBColor object.
- * @param green the green component of SVGRGBColor object.
- * @param blue the blue component of SVGRGBColor object.
- *
- * @return the newly created SVGRGBColor object with specified (r,g,b) values.
- *
- * @throws SVGException with error code SVG_INVALID_VALUE_ERR: if any of the parameters is not in the 0..255 range.</li>
- */
- public SVGRGBColor createSVGRGBColor(int red, int green, int blue)
- throws SVGException;
-}
--- a/javauis/m2g_qt/src/CM2GEventSource.cpp Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-/*
-* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Event server framework's event source implementation
-*
-*/
-
-// INCLUDE FILES
-#include "CM2GEventSource.h"
-
-M2G_NS_START
-
-// EXTERNAL DATA STRUCTURES
-
-// EXTERNAL FUNCTION PROTOTYPES
-
-// CONSTANTS
-
-// MACROS
-
-// LOCAL CONSTANTS AND MACROS
-
-// MODULE DATA STRUCTURES
-
-// LOCAL FUNCTION PROTOTYPES
-
-// FORWARD DECLARATIONS
-
-// -----------------------------------------------------------------------------
-// CM2GEventSource::NewL
-// -----------------------------------------------------------------------------
-TInt CM2GEventSource::NewL(
- JNIEnv& aJni, jobject aPeer, TJavaEventServer aServer)
-{
- M2G_DEBUG_0("M2G_DEBUG: CM2GEventSource::NewLC()");
- CM2GEventSource* self = new(ELeave) CM2GEventSource;
- // Cleanup the event source object if a leave occurs during construction:
- TConstructor selfCleanup(self, aJni);
- self->ConstructL(aJni, aPeer, aServer);
- // Pop the cleanup of the object and create a handle:
- return selfCleanup.GetHandle();
-}
-
-// -----------------------------------------------------------------------------
-// CM2GEventSource::~CM2GEventSource
-// -----------------------------------------------------------------------------
-CM2GEventSource::~CM2GEventSource()
-{
-}
-
-// -----------------------------------------------------------------------------
-// CM2GEventSource::CM2GEventSource
-// -----------------------------------------------------------------------------
-CM2GEventSource::CM2GEventSource()
-{
-}
-
-// -----------------------------------------------------------------------------
-// CM2GEventSource::CM2GEventSource
-// -----------------------------------------------------------------------------
-void CM2GEventSource::ConstructL(
- JNIEnv& aJni, jobject aPeer, TJavaEventServer aServer)
-{
- CJavaEventSourceBase::ConstructL(aJni, aPeer, aServer);
-}
-
-M2G_NS_END
-
--- a/javauis/m2g_qt/src/CM2GRenderContext.cpp Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,553 +0,0 @@
-/*
-* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Render context implementation
-*
-*/
-
-// INCLUDE FILES
-#include <eikenv.h> // CCoeEnv
-#include <graphics.h>
-
-#include "CM2GRenderContext.h"
-#include "MM2GSVGProxy.h"
-#include "svgtbitmap.h"
-#include <ImageConversion.h>
-#include <f32file.h>
-
-M2G_NS_START
-
-// EXTERNAL DATA STRUCTURES
-
-// EXTERNAL FUNCTION PROTOTYPES
-
-// CONSTANTS
-/* static */ const TReal32 MM2GRenderContext::KFullOpaque = 1.0;
-/* static */
-const TReal32 MM2GRenderContext::KFullTransparency = 0.0;
-/* static */
-const TUint8 MM2GRenderContext::KMaxAlphaValue = 255;
-/* static */
-const TDisplayMode MM2GRenderContext::KDefaultDisplayMode = EColor16MA;
-/* static */
-const TDisplayMode MM2GRenderContext::KMaskDisplayMode = EGray256;
-
-// MACROS
-
-// LOCAL CONSTANTS AND MACROS
-
-// MODULE DATA STRUCTURES
-
-// LOCAL FUNCTION PROTOTYPES
-
-// FORWARD DECLARATIONS
-
-// -----------------------------------------------------------------------------
-// CM2GRenderContext::CM2GRenderContext
-// -----------------------------------------------------------------------------
-CM2GRenderContext::CM2GRenderContext()
- : CBase(),
- iProxy(NULL),
- iEngineHandle(M2G_INVALID_HANDLE),
- iAlpha(MM2GRenderContext::KFullOpaque),
- iScaledAlpha(MM2GRenderContext::KMaxAlphaValue),
- iImgBmp(NULL),
- iWindowSurface(NULL)
-{
- M2G_DEBUG_0("M2G_DEBUG: CM2GRenderContext::CM2GRenderContext");
-}
-
-// -----------------------------------------------------------------------------
-// CM2GRenderContext::NewL
-// -----------------------------------------------------------------------------
-CM2GRenderContext* CM2GRenderContext::NewL(MM2GSVGProxy* aProxy)
-{
- M2G_DEBUG_0("M2G_DEBUG: CM2GRenderContext::NewL()");
-
- CM2GRenderContext* self = new(ELeave) CM2GRenderContext;
- CleanupStack::PushL(self);
-
- self->ConstructL(aProxy);
-
- CleanupStack::Pop();
-
- return self;
-}
-// -----------------------------------------------------------------------------
-// CM2GRenderContext::~CM2GRenderContext
-// -----------------------------------------------------------------------------
-CM2GRenderContext::~CM2GRenderContext()
-{
- M2G_DEBUG_2("M2G_DEBUG: CM2GRenderContext::~CM2GRenderContext() - proxy=%d, engine=%d", iProxy, iEngineHandle);
- if ((iEngineHandle != M2G_INVALID_HANDLE) && (iProxy != NULL))
- {
- TRAP_IGNORE(iProxy->DeleteSvgEngineL(iEngineHandle));
- }
- if(iWindowSurface)
- {
- delete iWindowSurface;
- }
- if(targetBitmap)
- {
- delete targetBitmap;
- }
- if(iTargetQImage)
- {
- delete iTargetQImage;
- }
- if(tempBitmapForMask)
- {
- delete tempBitmapForMask;
- }
- delete iImgBmp;
- iFbsSession.Disconnect();
-}
-
-// -----------------------------------------------------------------------------
-// CM2GRenderContext::BindL
-// -----------------------------------------------------------------------------
-void CM2GRenderContext::BindL(TInt& aTargetHandle)
- {
- M2G_DEBUG_0("M2G_DEBUG: CM2GRenderContext::BindL()");
- // get the screen size
- TSize screenSize = CEikonEnv::Static()->ScreenDevice()->SizeInPixels();
-
- iWindowSurface = (reinterpret_cast<Java::GFX::WindowSurface*>(aTargetHandle));
- //wSurfaceType = (Java::GFX::WindowSurfaceType)iWindowSurface->getType();
- wSurfaceType = Java::GFX::WsTypeQtImage;
-
- iWindowSurface->bind(wSurfaceType);
-
- switch(wSurfaceType)
- {
- case Java::GFX::WsTypeQtImage:
- User::LeaveIfNull(iOffScreenQImage = iWindowSurface->getQtImage());
- targetBitmap = new CSvgtBitmap ((TInt8*)iOffScreenQImage->bits(),
- TSize(iOffScreenQImage->size().width(),iOffScreenQImage->size().height()),
- EColor16MU,iOffScreenQImage->bytesPerLine());
- break;
-
- /*TODO for time being..case Java::GFX::WsTypeQtImage:
- User::LeaveIfNull(iTargetQImage = iWindowSurface->getQtImage());
- InitializeQImageOffscreenBufferL(screenSize,iTargetQImage);
- break;*/
-
- case Java::GFX::WsTypeSymbianBitmap:
- CFbsBitmap* tempBitmap;
- User::LeaveIfNull(tempBitmap = (reinterpret_cast<Java::GFX::WindowSurface*>(aTargetHandle)->getSymbianBitmap()));
- InitializeCFbsBitmapOffscreenBufferL(screenSize,tempBitmap);
- //iOffScreenBitmap = new(ELeave) CFbsBitmap();
- break;
-
- default:
- User::Leave(KErrNotSupported);
- break;
- }
-
- }
-
-// -----------------------------------------------------------------------------
-// CM2GRenderContext::InitializeQImageOffscreenBufferL
-// -----------------------------------------------------------------------------
-void CM2GRenderContext::InitializeQImageOffscreenBufferL(TSize aScreenSize,QImage* aQimage)
- {
- QSize aSize;
- aSize.setHeight(aScreenSize.iHeight);
- aSize.setWidth(aScreenSize.iWidth);
- iOffScreenQImage = new QImage(aSize,aQimage->format());
-
- //TODO For time being the format is EColor16MU
- targetBitmap = new CSvgtBitmap ((TInt8*)iOffScreenQImage->bits(),
- TSize(iOffScreenQImage->size().width(),iOffScreenQImage->size().height()),
- EColor16MU,iOffScreenQImage->bytesPerLine());
- }
-
-// -----------------------------------------------------------------------------
-// CM2GRenderContext::InitializeCFbsBitmapOffscreenBufferL
-// -----------------------------------------------------------------------------
-void CM2GRenderContext::InitializeCFbsBitmapOffscreenBufferL(TSize aScreenSize,CFbsBitmap* aBitmap)
- {
-
- iOffScreenBitmap = new(ELeave) CFbsBitmap();
- User::LeaveIfError(
- iOffScreenBitmap->Create(aScreenSize, aBitmap->DisplayMode()));
-
-// TODO check for stride in case of bitmap.
-// iTargetBitmap = new CSvgtBitmap( (TInt8*)iOffScreenBitmap->DataAddress() ,aScreenSize,iOffScreenBitmap->DisplayMode()/*KDefaultDisplayMode TODO chk this*/,iOffScreenBitmap->ScanLineLength(iOffScreenBitmap->SizeInPixels().iWidth,KDefaultDisplayMode) );
- }
-
-// -----------------------------------------------------------------------------
-// CM2GRenderContext::GetImgHandleL
-// -----------------------------------------------------------------------------
-/*
- * TODO we don't need method anymore as now we need Surface handle
- * TM2GBitmapHandle CM2GRenderContext::GetImgHandleL() const
-{
- User::LeaveIfNull(iImgBmp);
-
- return REINTERPRET_CAST(TM2GBitmapHandle, iImgBmp);
-}*/
-
-
-// -----------------------------------------------------------------------------
-// CM2GRenderContext::InitImageBitmapL
-// -----------------------------------------------------------------------------
-void CM2GRenderContext::InitImageBitmapL()
- {
- M2G_DEBUG_0("M2G_DEBUG: CM2GRenderContext::InitImageBitmapL() - begin");
- // get the screen size
- TSize screenSize = CEikonEnv::Static()->ScreenDevice()->SizeInPixels();
- switch (wSurfaceType)
- {
- case Java::GFX::WsTypeQtImage:
- {
- break;
- }
- case Java::GFX::WsTypeSymbianBitmap:
- {
- break;
- }
-
- default:
- break;
- }
- M2G_DEBUG_0("M2G_DEBUG: CM2GRenderContext::InitImageBitmapL() - end");
- }
-// -----------------------------------------------------------------------------
-// CM2GRenderContext::ReleaseL
-// -----------------------------------------------------------------------------
-void CM2GRenderContext::ReleaseL()
- {
- M2G_DEBUG_0("M2G_DEBUG: CM2GRenderContext::ReleaseL() - begin");
-
- iTargetQImage = NULL;
- iOffScreenQImage = NULL;
- iWindowSurface->release();
-
- M2G_DEBUG_0("M2G_DEBUG: CM2GRenderContext::ReleaseL() - end");
- }
-
-// -----------------------------------------------------------------------------
-// CM2GRenderContext::RenderL
-// -----------------------------------------------------------------------------
-void CM2GRenderContext::RenderLCDUIL(
- TM2GSvgDocumentHandle& aSvgDocHandle,
- const TReal32 aCurrentTime,
- TInt aSvgW, TInt aSvgH,
- TM2GRenderRect& aRect
-)
-{
- // prepare viewbox
- TRect viewbox;
- TPoint anchor;
-
- PrepareViewbox(aRect, aSvgW, aSvgH, viewbox, anchor);
- RenderLCDUIL(aSvgDocHandle, aCurrentTime, viewbox, anchor);
-}
-
-// -----------------------------------------------------------------------------
-void CM2GRenderContext::RenderESWTL(
- TM2GSvgDocumentHandle& aSvgDocHandle,
- const TReal32 aCurrentTime,
- TInt aSvgW, TInt aSvgH,
- TM2GRenderRect& aRect,
- TBool aUseNativeClear,
- TInt* aReturnData)
-{
- // prepare viewbox
- TRect viewbox;
- TPoint anchor;
-
- PrepareViewbox(aRect, aSvgW, aSvgH, viewbox, anchor);
-
- aReturnData[0] = 0;
- aReturnData[1] = 0;
- aReturnData[2] = 0;
- aReturnData[3] = 0;
- aReturnData[4] = anchor.iX;
- aReturnData[5] = anchor.iY;
- aReturnData[6] = viewbox.iTl.iX;
- aReturnData[7] = viewbox.iTl.iY;
- aReturnData[8] = viewbox.Width();
- aReturnData[9] = viewbox.Height();
-
- RenderESWTL(aSvgDocHandle, aCurrentTime, viewbox, anchor, aUseNativeClear, aReturnData);
-
- return;
-}
-// CM2GRenderContext::SetRenderingQualityL
-// -----------------------------------------------------------------------------
-void CM2GRenderContext::SetRenderingQualityL(TInt aMode)
-{
- M2G_DEBUG_0("M2G_DEBUG: CM2GRenderContext::SetRenderingQualityL()");
- User::LeaveIfNull(iProxy);
- iProxy->RenderQualityL(iEngineHandle, aMode);
-}
-
-// -----------------------------------------------------------------------------
-// CM2GRenderContext::SetTransparencyL
-// -----------------------------------------------------------------------------
-void CM2GRenderContext::SetTransparency(TReal32 aAlpha)
-{
- iAlpha = aAlpha;
- iScaledAlpha = STATIC_CAST(TUint8, (aAlpha * MM2GRenderContext::KMaxAlphaValue));
-}
-
-// -----------------------------------------------------------------------------
-// CM2GRenderContext::ConstructL
-// -----------------------------------------------------------------------------
-void CM2GRenderContext::ConstructL(MM2GSVGProxy* aProxy)
- {
- // Init member variables
- SetTransparency(MM2GRenderContext::KFullOpaque);
-
- M2G_DEBUG_0("M2G_DEBUG: CM2GRenderContext::ConstructL() - begin");
-
- if (aProxy)
- {
- iProxy = aProxy;
- iProxy->CreateSvgEngineL(iEngineHandle);
- M2G_DEBUG_2("M2G_DEBUG: CM2GRenderContext::ConstructL() - proxy: %d, new engine: %d", iProxy, iEngineHandle);
- }
- else
- {
- M2G_DEBUG_0("M2G_DEBUG: CM2GRenderContext::ConstructL() - proxy is invalid");
- M2G_THROW(KM2GArgNotOk);
- }
-
- User::LeaveIfError(iFbsSession.Connect());
- M2G_DEBUG_0("M2G_DEBUG: CM2GRenderContext::ConstructL() - end");
- }
-// -----------------------------------------------------------------------------
-// CM2GRenderContext::PrepareViewbox
-// -----------------------------------------------------------------------------
-void CM2GRenderContext::PrepareViewbox(
- TM2GRenderRect& aRr,
- TInt aSvgW, TInt aSvgH,
- TRect& aViewbox, TPoint& aAnchor)
-{
- M2G_DEBUG_6("M2G_DEBUG: CM2GRenderContext::PrepareViewbox() cX=%d, cY=%d, cW=%d, cH=%d, anchorX=%d, anchorY=%d - begin", aRr.GetClipX(), aRr.GetClipY(), aRr.GetClipW(), aRr.GetClipH(), aRr.GetAnchorX(), aRr.GetAnchorY());
-
- // Create an anchor point and an svg render area rect
- aAnchor.SetXY(aRr.GetAnchorX(), aRr.GetAnchorY());
- aViewbox.SetRect(aAnchor, TSize(aSvgW, aSvgH));
-
- // NOTE: It's already verified in Java side that the SVG render area and
- // the clip area intersects each other
- aViewbox.Intersection(aRr);
-
- // Check if the clip rect has changes the svg rect
- if (aViewbox.iTl != aAnchor)
- {
- // Update anchor position
- TPoint oldAnchor(aAnchor);
- aAnchor = aViewbox.iTl;
-
- // Update svg rect
- aViewbox.Move((-oldAnchor.iX), (-oldAnchor.iY));
- }
- else
- {
- // The clip rect has not changed the svg rect. Only the
- // anchor position need to be updated
- aViewbox.Move(-aAnchor.iX, -aAnchor.iY);
- }
- M2G_DEBUG_0("M2G_DEBUG: CM2GRenderContext::PrepareViewbox() - end");
-}
-
-void CM2GRenderContext::RenderLCDUIL(
- TM2GSvgDocumentHandle& aSvgDocHandle,
- TReal32 aCurrentTime,
- const TRect& aViewbox,
- const TPoint& aAnchor)
- {
- M2G_DEBUG_4("M2G_DEBUG: CM2GRenderContext::RenderL() viewbox: x=%d, y=%d, w=%d, h=%d begin", aViewbox.iTl.iX, aViewbox.iTl.iY, aViewbox.Size().iWidth, aViewbox.Size().iHeight);
-
- // No need to render if content is fully transparency (i.e. alpha=0)
- if (iScaledAlpha == 0)
- {
- return;
- }
-
- QStringList list;
- list <<"QImage-Format_RGB32";
- TBuf8<32> fname;
-
- // 1: render the svg document on the iImgBmp
- iProxy->RenderDocumentL(
- iEngineHandle,
- aSvgDocHandle,
- (TM2GSvgBitmapHandle)targetBitmap
- , (TUint)NULL, aCurrentTime);
-
- fname.Zero();
- fname.Format(_L8("c:\\%s.bmp"), list.at(0).toLocal8Bit().constData());
- TBool ret = iOffScreenQImage->save((const char*)fname.PtrZ());
-
- QPixmap pixmap = QPixmap::fromImage(*iOffScreenQImage);
- tempBitmapForMask = pixmap.toSymbianCFbsBitmap();
-
- TFileName bitmapFilename;
- bitmapFilename.Copy(_L("c:\\bugbitmap"));
- bitmapFilename.AppendNum(tempBitmapForMask->Handle());
- bitmapFilename.Append(_L(".bmp"));
- SaveBitmapL(*tempBitmapForMask, bitmapFilename);
-
- iWindowSurface->release();
- M2G_DEBUG_0("M2G_DEBUG: CM2GRenderContext::RenderL() end");
- }
-
-// -----------------------------------------------------------------------------
-/*TODO
- * Write the separate RenderDocumentL method for QImage and CFbsBitmap
- * also handle subsequent BitBlt and
- * CreateAlphaBlendMaskL
- * */
-void CM2GRenderContext::RenderESWTL(
- TM2GSvgDocumentHandle& aSvgDocHandle,
- TReal32 aCurrentTime,
- const TRect& aViewbox,
- const TPoint& aAnchor,
- TBool /*aUseNativeClear*/,
- TInt* aReturnData)
-{
-
-}
-// CM2GRenderContext::CreateAlphaBlendMask
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-// CM2GRenderContext::ClearBitmapL
-// -----------------------------------------------------------------------------
-void CM2GRenderContext::ClearBitmapL(CFbsBitmap* aBmp)
-{
- M2G_DEBUG_0("M2G_DEBUG: CM2GRenderContext::ClearBitmap - begin");
-
- User::LeaveIfNull(aBmp);
-
- TM2GBitmapLock lock(aBmp);
-
- TSize size = aBmp->SizeInPixels();
- TInt scanlineLength = aBmp->ScanLineLength(size.iWidth, aBmp->DisplayMode());
-
- TUint32* buf = aBmp->DataAddress();
- char* bufBytes = REINTERPRET_CAST(char*, buf);
-
- Mem::FillZ(bufBytes, size.iHeight * scanlineLength);
-
- M2G_DEBUG_0("M2G_DEBUG: CM2GRenderContext::ClearBitmap - end");
-}
-
-
-void CM2GRenderContext::ClearSurfaceL(TM2GSvgBitmapHandle aSvgtBmpHandle )
- {
- M2G_DEBUG_0("M2G_DEBUG: CM2GRenderContext::ClearBitmap - begin");
-//TODO As Currently we are not using this functionality.
-/* switch(wSurfaceType)
- {
- case Java::GFX::WsTypeQtImage:
- QImage* tempQImage;
- User::LeaveIfNull(tempQImage = (reinterpret_cast<Java::GFX::WindowSurface*>(aSvgtBmpHandle)->getQtImage()));
- //TODO Do we need to lock the qimage as implemented below TM2GBitmapLock lock(tempBitmap);?
- QSize sizeQimage = tempQImage->size();//TODO Check for SizeInPixels
- TInt scanlineLengthQimage = tempQImage->bytesPerLine();
- //uchar* bufBytesQimage = REINTERPRET_CAST(uchar*, tempQImage->bits());
-
- Mem::FillZ(tempQImage->bits(), sizeQimage.height() * scanlineLengthQimage);
-
- M2G_DEBUG_0("M2G_DEBUG: CM2GRenderContext::ClearSurface Qimage Clear function- end");
- break;
-
- case Java::GFX::WsTypeSymbianBitmap:
- CFbsBitmap* tempBitmap;
- User::LeaveIfNull(tempBitmap = (reinterpret_cast<Java::GFX::WindowSurface*>(aSvgtBmpHandle)->getSymbianBitmap()));
- TM2GBitmapLock lock(tempBitmap);
- TSize sizeBmp = tempBitmap->SizeInPixels();
- TInt scanlineLengthBmp = tempBitmap->ScanLineLength(sizeBmp.iWidth, tempBitmap->DisplayMode());
- TUint32* bufBmp = tempBitmap->DataAddress();
- char* bufBytesBmp = REINTERPRET_CAST(char*, bufBmp);
-
- Mem::FillZ(bufBytesBmp, sizeBmp.iHeight * scanlineLengthBmp);
-
- M2G_DEBUG_0("M2G_DEBUG: CM2GRenderContext::ClearSurface Bitmap Clear function- end");
- break;
-
- default:
- M2G_DEBUG_0("M2G_DEBUG: CM2GRenderContext::ClearBitmap Type Not Supported.- end");
- User::Leave(KErrNotSupported);
- break;
- }
- */
- }
-
-// -----------------------------------------------------------------------------
-// CM2GRenderContext::FillBitmapL
-// -----------------------------------------------------------------------------
-void CM2GRenderContext::FillBitmapL(CFbsBitmap* aBmp, const TUint8& aChar)
-{
- M2G_DEBUG_1("M2G_DEBUG: CM2GRenderContext::FillBitmap() filled with=%d - begin", aChar);
- User::LeaveIfNull(aBmp);
- TM2GBitmapLock lock(aBmp);
-
- TSize size = aBmp->SizeInPixels();
- TInt scanlineLength = aBmp->ScanLineLength(size.iWidth, aBmp->DisplayMode());
-
- TUint32* buf = aBmp->DataAddress();
- char* bufBytes = REINTERPRET_CAST(char*, buf);
-
- Mem::Fill(bufBytes, size.iHeight * scanlineLength, aChar);
-
- M2G_DEBUG_0("M2G_DEBUG: CM2GRenderContext::FillBitmap - end");
-}
-
-// -----------------------------------------------------------------------------
-// CM2GRenderContext::GetBufferHandleL
-// -----------------------------------------------------------------------------
-TM2GSvgBitmapHandle CM2GRenderContext::GetBufferHandleL() const
- {
- switch(wSurfaceType)
- {
- case Java::GFX::WsTypeQtImage:
- User::LeaveIfNull(iOffScreenQImage);
- return REINTERPRET_CAST(TM2GSvgBitmapHandle , iOffScreenQImage);
- break;
-
- case Java::GFX::WsTypeSymbianBitmap:
- User::LeaveIfNull(iOffScreenBitmap);
- return REINTERPRET_CAST(TM2GSvgBitmapHandle , iOffScreenBitmap);
- break;
-
- default:
- User::Leave(KErrNotSupported);
- break;
- }
-
- }
-
-//CODE to check the Bitmap Contain.
-TInt CM2GRenderContext::SaveBitmapL(const CFbsBitmap& aNVGBitmap, const TFileName& aFileName)
- {
- TFileName bitmapFilename;
- bitmapFilename.Copy(aFileName);
- RFs aFs;
- User::LeaveIfError(aFs.Connect());
- CImageEncoder * imgEncoder = 0;
- TRequestStatus requesStatus = 0;
- imgEncoder = CImageEncoder::FileNewL(aFs, bitmapFilename, _L8("image/bmp"), CImageEncoder::EOptionAlwaysThread);
- imgEncoder->Convert(&requesStatus, aNVGBitmap);
- User::WaitForRequest(requesStatus);
- delete imgEncoder;
- aFs.Close();
- return 0;
- }
-
-M2G_NS_END
--- a/javauis/m2g_qt/src/CM2GSVGProxy.cpp Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1124 +0,0 @@
-/*
-* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: SVGTopt proxy implementation
-*
-*/
-
-// INCLUDE FILES
-#include <AknUtils.h> // Files add recently
-#include <avkon.hrh> // Files add recently
-#include <SvgJavaInterfaceImpl.h>
-#include <utf.h> // Character conversion API
-#include <featmgr.h>
-#include "CM2GSVGProxy.h"
-
-M2G_NS_START
-
-// EXTERNAL DATA STRUCTURES
-
-// EXTERNAL FUNCTION PROTOTYPES
-
-// CONSTANTS
-
-// MACROS
-
-// LOCAL CONSTANTS AND MACROS
-
-// MODULE DATA STRUCTURES
-
-// LOCAL FUNCTION PROTOTYPES
-
-// FORWARD DECLARATIONS
-
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::NewL
-// -----------------------------------------------------------------------------
-CM2GSVGProxy* CM2GSVGProxy::NewL()
-{
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::NewL()");
- CM2GSVGProxy* self = new(ELeave) CM2GSVGProxy;
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop();
- return self;
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::~CM2GSVGProxy
-// -----------------------------------------------------------------------------
-CM2GSVGProxy::~CM2GSVGProxy()
-{
- M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::~CM2GSVGProxy() - native SVGTopt: %d", iNative);
- if (iNative)
- {
- CloseContainers();
- delete iNative;
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::~CM2GSVGProxy() - native deleted");
- iNative = NULL;
- }
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::AddCloseL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::AddCloseL(const TM2GSvgPathHandle& aPathHandle)
-{
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::AddCloseL() - begin");
- iNative->SvgPathAddClose(aPathHandle);
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::AddCloseL() - end");
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::AddCurveToL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::AddCurveToL(
- const TM2GSvgPathHandle& aPathHandle,
- const TM2GPathCurveData& aPathCurveData)
-{
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::AddCurveToL() - begin");
- iNative->SvgPathAddCurveTo(
- aPathHandle,
- aPathCurveData[ 0 ], aPathCurveData[ 1 ], // X1, Y1
- aPathCurveData[ 2 ], aPathCurveData[ 3 ], // X2, Y2
- aPathCurveData[ 4 ], aPathCurveData[ 5 ]); // X3, Y3
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::AddCurveToL() - end");
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::AddLineToL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::AddLineToL(
- const TM2GSvgPathHandle& aPathHandle,
- const TReal32& aX, const TReal32& aY)
-{
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::AddLineToL() - begin");
- iNative->SvgPathAddLineTo(aPathHandle, aX, aY);
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::AddLineToL() - end");
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::AddMoveToL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::AddMoveToL(
- const TM2GSvgPathHandle& aPathHandle,
- const TReal32& aX, const TReal32& aY)
-{
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::AddMoveToL() - begin");
- iNative->SvgPathAddMoveTo(aPathHandle, aX, aY);
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::AddMoveToL() - end");
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::AddQuadToL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::AddQuadToL(
- const TM2GSvgPathHandle& aPathHandle,
- const TReal32& aX1, const TReal32& aY1,
- const TReal32& aX2, const TReal32& aY2)
-{
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::AddQuadToL() - begin");
- iNative->SvgPathAddQuadTo(aPathHandle, aX1, aY1, aX2, aY2);
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::AddQuadToL() - end");
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::AppendChildL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::AppendChildL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgElementHandle& aChildElementHandle)
-{
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::AppendChildL() - begin");
- iNative->SvgElementAppendChild(aElementHandle, aChildElementHandle);
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::AppendChildL() - end");
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::BeginElementAtL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::BeginElementAtL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- const TM2GSvgElementHandle& aElementHandle,
- const TReal32& aOffset)
-{
- M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::BeginElementAtL() offset:%f - begin", aOffset);
- iNative->SvgDocumentBeginElementAt(
- aDocumentHandle, aElementHandle, aOffset);
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::BeginElementAtL() - end");
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::CheckRemoveableL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::CheckRemoveableL(
- const TM2GSvgElementHandle& aElementHandle,
- TInt& aRemoveable)
-
-{
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::CheckRemoveableL() - begin");
- aRemoveable = iNative->SvgElementCheckRemoveable(aElementHandle);
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::CheckRemoveableL() - end");
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::ClearSvgSurfaceL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::ClearSvgSurfaceL(const TM2GBitmapHandle& /* aSurfaceHandle */)
-{
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::ClearSvgSurfaceL() - not supported");
- User::Leave(KErrNotSupported);
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::CreateDocumentL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::CreateDocumentL(const TPtrC16& aData, TM2GSvgDocumentHandle& aDocumentHandle)
-{
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::CreateDocumentL() - begin");
- aDocumentHandle = M2G_INVALID_HANDLE;
-
- M2G_DEBUG_1("M2G_DEBUG: M2G_DEBUG: CM2GSVGProxy::CreateDocumentL(): content length=%d - call engine", aData.Length());
-
- // Create document handle. Note: validity check is done in java side
- aDocumentHandle = iNative->SvgDocumentCreateL(aData);
- // Append document handle to the container
- if (iSvgDocuments.Find(aDocumentHandle) == KErrNotFound)
- {
- TRAPD(err, iSvgDocuments.Append(aDocumentHandle));
- if (err != KM2GOk)
- {
- M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::CreateDocumentL(), cannot add handle=%d, err=%d", aDocumentHandle, err);
- }
- }
- M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::CreateDocumentL(), handle=%d, total document count=%d - end", aDocumentHandle, iSvgDocuments.Count());
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::CreateElementNsL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::CreateElementNsL(
- const TM2GSvgAttrType& aType,
- const TM2GSvgDocumentHandle& /* aDocumentHandle */,
- TM2GSvgElementHandle& aElementHandle)
-{
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::CreateElementNsL() - begin");
- // Note: validity check is done in java side
- aElementHandle = iNative->SvgElementCreate(aType);
- M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::CreateElementNsL() handle=%d - end", aElementHandle);
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::CreatePathL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::CreatePathL(TM2GSvgPathHandle& aPathHandle)
-{
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::CreatePathL() - begin");
- aPathHandle = iNative->SvgPathCreate();
- if (aPathHandle == M2G_INVALID_HANDLE)
- {
- User::Leave(KM2GMemoryNotOk);
- }
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::CreatePathL() - end");
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::CreateSvgEngineL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::CreateSvgEngineL(TM2GSvgEngineHandle& aEngineHandle)
-{
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::CreateSvgEngineL() - begin");
- // Create engine handle
- aEngineHandle = iNative->SvgEngineCreate();
- if (aEngineHandle == M2G_INVALID_HANDLE)
- {
- User::Leave(KM2GMemoryNotOk);
- }
- // Append engine handle to the container
- if (iSvgEngines.Find(aEngineHandle) == KErrNotFound)
- {
- TRAPD(err, iSvgEngines.Append(aEngineHandle));
- if (err != KM2GOk)
- {
- M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::CreateSvgEngineL(), cannot add handle=%d, err=%d", aEngineHandle, err);
- }
- }
- M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::CreateSvgEngineL(), handle=%d, total engine count=%d - end", aEngineHandle, iSvgEngines.Count());
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::CreateSvgSurfaceL
-// -----------------------------------------------------------------------------
-TM2GBitmapHandle CM2GSVGProxy::CreateSvgSurfaceL(TInt /* aWidth */, TInt /* aHeight */)
-{
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::CreateSvgSurfaceL() - not supported");
-
- User::Leave(KErrNotSupported);
-
- return M2G_INVALID_HANDLE;
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::DeleteDocumentL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::DeleteDocumentL(const TM2GSvgDocumentHandle& aDocumentHandle)
-{
- M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::DeleteDocumentL() native:%d, document:%d - begin", iNative, aDocumentHandle);
- TInt findResult = iSvgDocuments.Find(aDocumentHandle);
- if (findResult != KErrNotFound)
- {
- // Try to remove the handle from the container
- TRAPD(err, iSvgDocuments.Remove(findResult));
- if (err != KM2GOk)
- {
- M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::DeleteDocumentL(), cannot add handle=%d, err=%d", aDocumentHandle, err);
- }
- M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::DeleteDocumentL() - container remove result=%d", err);
- // Delete the handle
- iNative->SvgDocumentDestroy(aDocumentHandle);
- }
- M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::DeleteDocumentL() - total document count=%d - end", iSvgDocuments.Count());
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::DeleteSvgEngineL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::DeleteSvgEngineL(const TM2GSvgEngineHandle& aEngineHandle)
-{
- M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::DeleteSvgEngineL() engine:%d - begin", aEngineHandle);
- TInt findResult = iSvgEngines.Find(aEngineHandle);
- if (findResult != KErrNotFound)
- {
- // Try to remove the handle from the container
- TRAPD(err, iSvgEngines.Remove(findResult));
- if (err != KM2GOk)
- {
- M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::DeleteSvgEngineL(), cannot add handle=%d, err=%d", aEngineHandle, err);
- }
- M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::DeleteSvgEngineL() - container remove result=%d", err);
- // Delete the handle
- iNative->SvgEngineDestroy(aEngineHandle);
- }
- M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::DeleteSvgEngineL() - total engine count=%d - end", iSvgEngines.Count());
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::DeleteSvgSurfaceL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::DeleteSvgSurfaceL(const TM2GBitmapHandle& /* aSurfaceHandle */)
-{
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::DeleteSvgSurfaceL() - not supported");
-
- User::Leave(KErrNotSupported);
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::DestroyPathL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::DestroyPathL(const TM2GSvgPathHandle& aPathHandle)
-{
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::DestroyPathL() - begin");
- iNative->SvgPathDestroy(aPathHandle);
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::DestroyPathL() - end");
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::DispatchMouseEventL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::DispatchMouseEventL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- TInt aX, TInt aY, TM2GSvgElementHandle& aElementHandle)
-{
- M2G_DEBUG_3("M2G_DEBUG: CM2GSVGProxy::DispatchMouseEventL(): doc handle:%d, x=%d, y=%d- begin", aDocumentHandle, aX, aY);
- aElementHandle = iNative->SvgDocumentDispatchMouseEvent(
- aDocumentHandle, aX, aY);
- M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::DispatchMouseEventL(): element handle=%d - end", aElementHandle);
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::EndElementAtL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::EndElementAtL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- const TM2GSvgElementHandle& aElementHandle,
- const TReal32& aOffset)
-{
- M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::EndElementAtL() offset=%f - begin", aOffset);
- iNative->SvgDocumentEndElementAt(
- aDocumentHandle, aElementHandle, aOffset);
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::EndElementAtL() - end");
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::FocusOnL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::FocusOnL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- const TM2GSvgElementHandle& aElementHandle)
-{
- M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::FocusOnL() document=%d, element=%d - begin", aDocumentHandle, aElementHandle);
- iNative->SvgDocumentFocusOn(aDocumentHandle, aElementHandle);
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::FocusOnL() - end");
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::FocusOutL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::FocusOutL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- const TM2GSvgElementHandle& aElementHandle)
-{
- M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::FocusOutL() document=%d, element=%d - begin", aDocumentHandle, aElementHandle);
- iNative->SvgDocumentFocusOut(aDocumentHandle, aElementHandle);
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::FocusOutL() - end");
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::GetBBoxL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::GetBBoxL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgAttrType& aAttributeType,
- TM2GRectData& aRectData, TInt& aResult)
-{
- aResult = KM2GOk;
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetBBoxL() - begin");
- iNative->SvgElementGetBBox(
- aElementHandle,
- aAttributeType,
- &aRectData[ 0 ], // X
- &aRectData[ 1 ], // Y
- &aRectData[ 2 ], // Width
- &aRectData[ 3 ]); // Height
- M2G_DEBUG_4("M2G_DEBUG: CM2GSVGProxy::GetBBoxL(): [x=%f, y=%f, w=%f, h=%f] - end", aRectData[ 0 ], aRectData[ 1 ], aRectData[ 2 ], aRectData[ 3 ]);
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::GetColorTrait
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::GetColorTraitL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgAttrType& aAttributeType,
- TM2GColorData& aColor,
- TInt& aResult)
-{
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetColorTraitL() - begin");
- aResult = iNative->SvgElementGetColorAttribute(
- aElementHandle,
- aAttributeType,
- &aColor[ 0 ], // Red
- &aColor[ 1 ], // Green
- &aColor[ 2 ]); // Blue
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetColorTraitL() - end");
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::GetElementByIdL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::GetElementByIdL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- const TPtrC16& aId,
- TM2GSvgElementHandle& aElementHandle)
-{
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetElementByIdL() - begin");
- aElementHandle = iNative->SvgDocumentGetElementById(
- aDocumentHandle,
- aId);
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetElementByIdL() - end");
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::GetElementTypeIdL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::GetElementTypeIdL(const TM2GSvgElementHandle& aElementHandle, TInt16& aId)
-{
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetElementTypeIdL() - begin");
- aId = STATIC_CAST(TInt16, iNative->SvgElementGetType(aElementHandle));
- M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetElementTypeIdL() type id:%d- end", aId);
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::GetEnumTraitL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::GetEnumTraitL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgAttrType& aAttributeTypeId,
- TInt16& aEnumTrait)
-{
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetEnumTraitIdL() - begin");
- aEnumTrait = iNative->SvgElementGetEnumAttribute(
- aElementHandle,
- aAttributeTypeId);
- M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetEnumTraitIdL() enum trait:%d - end", aEnumTrait);
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::GetExternalListItemL
-// -----------------------------------------------------------------------------
-TInt CM2GSVGProxy::GetExternalListItemL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- TInt aIndex,
- TPtrC16& aItem)
-{
- M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetExternalListItemL() index=%d- begin", aIndex);
- TInt result = iNative->SvgDocumentGetExternalListItem(aDocumentHandle, aIndex, aItem);
- M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::GetExternalListListItemL() result:%d, item sz:%d - end", result, aItem.Length());
- return result;
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::GetExternalListSizeL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::GetExternalListSizeL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- TInt& aListSz)
-{
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetExternalListSizeL() - begin");
- aListSz = iNative->SvgDocumentGetExternalListSize(aDocumentHandle);
- M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetExternalListSizeL(): %d - end", aListSz);
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::GetFirstElementChildL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::GetFirstElementChildL(
- const TM2GSvgElementHandle& aElementHandle,
- TM2GSvgElementHandle& aChildHandle)
-{
- M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetFirstElementChildL() element=%d - begin", aElementHandle);
- aChildHandle = iNative->SvgElementGetFirstElementChild(aElementHandle);
- M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetFirstElementChildL() child=%d - end", aChildHandle);
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::GetFloatTraitL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::GetFloatTraitL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgAttrType& aAttributeType,
- TReal32& aFloatTrait)
-{
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetFloatTraitL() - begin");
- aFloatTrait =
- iNative->SvgElementGetFloatAttribute(aElementHandle, aAttributeType);
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetFloatTraitL() - end");
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::GetMatrixTraitL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::GetMatrixTraitL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgAttrType& aAttributeType,
- TM2GMatrixData& aMatrix, TInt& aResult)
-{
- // [ m00 m01 m02 ]
- // [ m10 m11 m12 ]
- // [ 0 0 1 ]
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetMatrixTraitL() - begin");
- aResult = iNative->SvgElementGetMatrixAttribute(
- aElementHandle,
- aAttributeType,
- &aMatrix[ 0 ], // m00
- &aMatrix[ 1 ], // m10
- &aMatrix[ 2 ], // m01
- &aMatrix[ 3 ], // m11
- &aMatrix[ 4 ], // m02
- &aMatrix[ 5 ]); // m12
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetMatrixTraitL() - end");
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::GetMediaTimeL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::GetMediaTimeL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- TReal32& aSeconds)
-{
- aSeconds = iNative->SvgDocumentGetMediaTime(aDocumentHandle);
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::GetNextElementSiblingL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::GetNextElementSiblingL(
- const TM2GSvgElementHandle& aElementHandle,
- TM2GSvgElementHandle& aSiblingElementHandle)
-{
- M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetNextElementSiblingL(), element=%d - begin", aElementHandle);
- aSiblingElementHandle = iNative->SvgElementGetNextElementSibling(aElementHandle);
- M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetNextElementSiblingL(), sibling=%d - end", aSiblingElementHandle);
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::GetNumberOfSegmentsL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::GetNumberOfSegmentsL(
- const TM2GSvgPathHandle& aPathHandle,
- TInt& aNumberOfSegments)
-{
- aNumberOfSegments = iNative->SvgPathGetSegmentCount(aPathHandle);
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::GetParentL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::GetParentL(
- const TM2GSvgElementHandle& aElementHandle,
- TM2GSvgElementHandle& aParentElementHandle)
-{
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetParentL() - begin");
- aParentElementHandle = iNative->SvgElementGetParent(aElementHandle);
- M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::GetParentL() element=%d, parent=%d, - end", aElementHandle, aParentElementHandle);
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::GetPathTraitL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::GetPathTraitL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgAttrType& aAttributeType,
- TInt& aPathTrait)
-{
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetPathTraitL() - begin");
- aPathTrait = iNative->SvgElementGetPathAttribute(aElementHandle, aAttributeType);
- M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetPathTraitL() %d - end", aPathTrait);
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::GetRectTraitL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::GetRectTraitL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgAttrType& aAttributeType,
- TM2GRectData& aRectData, TInt& aResult)
-{
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetRectTraitL() - begin");
- aResult = iNative->SvgElementGetRectAttribute(
- aElementHandle,
- aAttributeType,
- &aRectData[ 0 ], // X
- &aRectData[ 1 ], // Y
- &aRectData[ 2 ], // Width
- &aRectData[ 3 ]); // Height
- M2G_DEBUG_5("M2G_DEBUG: CM2GSVGProxy::GetRectTraitL(): result=%d [x=%f, y=%f, w=%f, h=%f] - end", aResult, aRectData[ 0 ], aRectData[ 1 ], aRectData[ 2 ], aRectData[ 3 ]);
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::GetRootElementL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::GetRootElementL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- TM2GSvgElementHandle& aRootElementHandle)
-{
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetRootElementL() - begin");
- aRootElementHandle = iNative->SvgDocumentGetRootElement(aDocumentHandle);
- M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetRootElementL() handle:%d - end", aRootElementHandle);
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::GetScreenBBoxL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::GetScreenBBoxL(
- const TM2GSvgElementHandle& aElementHandle,
- TM2GScreenBBoxData& aScreenBBoxData)
-{
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetScreenBBoxL() - begin");
- iNative->SvgElementGetScreenBBox(
- aElementHandle,
- &aScreenBBoxData[ 0 ], // X
- &aScreenBBoxData[ 1 ], // Y
- &aScreenBBoxData[ 2 ], // Width
- &aScreenBBoxData[ 3 ]); // Height
- M2G_DEBUG_4("M2G_DEBUG: CM2GSVGProxy::GetScreenBBoxL(): [x=%f, y=%f, w=%f, h=%f] - end", aScreenBBoxData[ 0 ], aScreenBBoxData[ 1 ], aScreenBBoxData[ 2 ], aScreenBBoxData[ 3 ]);
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::GetSegmentParameterL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::GetSegmentParameterL(
- const TM2GSvgPathHandle& aPathHandle,
- TInt aSegmentIndex, TInt aParamIndex,
- TReal32& aSegmentParam)
-{
- M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::SvgPathGetSegmentParameter(): index=%d, paramIndex=%d - begin", aSegmentIndex, aParamIndex);
- aSegmentParam = iNative->SvgPathGetSegmentParameter(
- aPathHandle,
- aSegmentIndex,
- aParamIndex);
- M2G_DEBUG_3("M2G_DEBUG: CM2GSVGProxy::SvgPathGetSegmentParameter(): index=%d, paramIndex=%d, param=%d - end", aSegmentIndex, aParamIndex, aSegmentParam);
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::GetSegmentTypeL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::GetSegmentTypeL(
- const TM2GSvgPathHandle& aPathHandle,
- TInt aSegmentIndex,
- TInt16& aSegmentType)
-{
- M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetSegmentTypeL(): index=%d - begin", aSegmentIndex);
- aSegmentType = iNative->SvgPathGetSegmentType(
- aPathHandle,
- aSegmentIndex);
- M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::GetSegmentTypeL(): index=%d, type=%d - end", aSegmentIndex, aSegmentType);
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::GetStringTraitL
-// -----------------------------------------------------------------------------
-TInt CM2GSVGProxy::GetStringTraitL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgAttrType& aAttributeType,
- TPtrC16& aStr)
-{
- M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::GetStringTraitL(): attribute type:%d, handle:%u - begin", aAttributeType, aElementHandle);
-
- TInt result = iNative->SvgElementGetStringAttribute(aElementHandle, aAttributeType, aStr);
- M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetStringTraitL(): attribute sz:%d", aStr.Length());
- return result;
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::GetSvgSurfaceHeightL
-// -----------------------------------------------------------------------------
-TInt CM2GSVGProxy::GetSvgSurfaceHeightL(const TM2GBitmapHandle& /* aSurfaceHandle */)
-{
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetSvgSurfaceHeightL - not supported");
-
- User::Leave(KErrNotSupported);
-
- return 0;
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::GetSvgSurfaceWidthL
-// -----------------------------------------------------------------------------
-TInt CM2GSVGProxy::GetSvgSurfaceWidthL(const TM2GBitmapHandle& /* aSurfaceHandle */)
-{
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::GetSvgSurfaceWidthL - not supported");
-
- User::Leave(KErrNotSupported);
-
- return 0;
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::GetUsedFromElementL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::GetUsedFromElementL(
- const TM2GSvgElementHandle& aElementHandle,
- TM2GSvgElementHandle& aHandle)
-{
- M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetUsedFromElementL() used from element=%d - begin", aElementHandle);
- aHandle = iNative->SvgElementGetUsedFromElement(aElementHandle);
- M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::GetUsedFromElementL() found element=%d - end", aHandle);
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::GetViewportHeightL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::GetViewportHeightL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- TInt& aHeight)
-{
- aHeight = iNative->SvgDocumentGetViewportHeight(aDocumentHandle);
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::GetViewportWidthL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::GetViewportWidthL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- TInt& aWidth)
-{
- aWidth = iNative->SvgDocumentGetViewportWidth(aDocumentHandle);
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::InitViewportL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::InitViewportL(const TM2GSvgDocumentHandle& aDocumentHandle)
-{
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::InitViewportL()");
- return iNative->SvgDocumentViewportInit(aDocumentHandle);
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::InsertBeforeL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::InsertBeforeL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgElementHandle& aNewChildElementHandle,
- const TM2GSvgElementHandle& aReferenceElementHandle)
-{
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::InsertBeforeL() - begin");
- iNative->SvgElementInsertBefore(
- aElementHandle,
- aNewChildElementHandle,
- aReferenceElementHandle);
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::InsertBeforeL() - end");
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::IsActiveL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::IsActiveL(const TM2GSvgElementHandle& aElementHandle, TInt& aActive)
-{
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::IsActiveL() - begin");
- aActive = iNative->SvgElementIsActive(aElementHandle);
- M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::IsActiveL() active:%d - end", aActive);
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::IsElementInDomL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::IsElementInDomL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- const TM2GSvgElementHandle& aElementHandle,
- TInt& aIsElementInDom)
-{
- M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::IsElementInDomL() doc handle=%d, elem handle=%d - begin", aDocumentHandle, aElementHandle);
- aIsElementInDom = iNative->SvgElementElementInDOM(
- aDocumentHandle, aElementHandle);
- M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::IsElementInDomL() result=%d - end", aIsElementInDom);
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::IsUsedL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::IsUsedL(const TM2GSvgElementHandle& aElementHandle, TInt& aResult)
-{
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::IsUsedL() - begin");
- aResult = iNative->SvgElementIsUsed(aElementHandle);
- M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::IsUsedL(), result=%d - end", aResult);
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::RemoveChildL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::RemoveChildL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgElementHandle& aChildElementHandle,
- TM2GSvgElementHandle& aHandle)
-{
- M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::RemoveChildL() parent=%d, child=%d - begin", aElementHandle, aChildElementHandle);
- aHandle = iNative->SvgElementRemoveChild(aElementHandle, aChildElementHandle);
- M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::RemoveChildL() result handle=%d - end", aHandle);
-}
-
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::RenderDocumentL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::RenderDocumentL(
- const TM2GSvgEngineHandle& aEngineHandle,
- const TM2GSvgDocumentHandle& aDocumentHandle,
- const TM2GBitmapHandle& aSurfaceHandle,
- TM2GBitmapHandle aSurfaceMaskHandle,
- TReal32 aCurrentTime)
-{
- M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::RenderDocumentL() native:%d, time=%f - begin", iNative, aCurrentTime);
- M2G_DEBUG_3("M2G_DEBUG: CM2GSVGProxy::RenderDocumentL() engine:%d, doc:%d, surface:%d", aEngineHandle, aDocumentHandle, aSurfaceHandle);
- iNative->SvgEngineRenderDocument(
- aEngineHandle, aDocumentHandle, aSurfaceHandle, aSurfaceMaskHandle, aCurrentTime);
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::RenderDocumentL() - end");
-}
-
-//TODO following changes done for Qimage
-//Check for TUint or TInt for subsequent API Call
-void CM2GSVGProxy::RenderDocumentL(
- const TM2GSvgEngineHandle& aEngineHandle,
- const TM2GSvgDocumentHandle& aDocumentHandle,
- const TM2GSvgBitmapHandle& aSurfaceHandle,
- TM2GSvgBitmapHandle aSurfaceMaskHandle,
- TReal32 aCurrentTime)
- {
- M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::RenderDocumentL() Qimage variant native:%d, time=%f - begin", iNative, aCurrentTime);
- M2G_DEBUG_3("M2G_DEBUG: CM2GSVGProxy::RenderDocumentL() engine:%d, doc:%d, SvgBitmapHandle:%d", aEngineHandle, aDocumentHandle, aSurfaceHandle);
- iNative->SvgEngineRenderDocument(
- aEngineHandle, aDocumentHandle, aSurfaceHandle, aSurfaceMaskHandle, aCurrentTime);
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::RenderDocumentL() - end");
-
- }
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::RenderQualityL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::RenderQualityL(
- const TM2GSvgDocumentHandle& aEngineHandle,
- TInt aQuality)
-{
- iNative->SvgEngineSetRenderQuality(aEngineHandle, aQuality);
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::RequestCompletedL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::RequestCompletedL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- const TPtrC16& aURI,
- const TPtrC8& aResourceData,
- TInt& aCompleted)
-{
- M2G_DEBUG_2("M2G_DEBUG: CM2GSVGProxy::RequestCompleted() uri sz=%d, resource sz= %d ", aURI.Length(), aResourceData.Length());
- aCompleted = iNative->SvgDocumentRequestCompleted(
- aDocumentHandle,
- aURI,
- aResourceData);
- M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::RequestCompletedL() completed=%d - end", aCompleted);
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::SetColorTraitL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::SetColorTraitL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgAttrType& aAttributeType,
- const TM2GColorData& aColor)
-{
- iNative->SvgElementSetColorAttribute(
- aElementHandle,
- aAttributeType,
- aColor[ 0 ], // red
- aColor[ 1 ], // green
- aColor[ 2 ]); // blue
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::SetEnumTraitL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::SetEnumTraitL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgAttrType& aAttributeType,
- TInt16 aValue)
-{
- iNative->SvgElementSetEnumAttribute(
- aElementHandle,
- aAttributeType,
- aValue);
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::SetFloatTraitL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::SetFloatTraitL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgAttrType& aAttributeType,
- const TReal32& aValue)
-{
- M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::SetFloatTraitL() - %f", aValue);
- iNative->SvgElementSetFloatAttribute(
- aElementHandle,
- aAttributeType,
- aValue);
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::SetMatrixTraitL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::SetMatrixTraitL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgAttrType& aAttributeType,
- const TM2GMatrixData& aMatrix)
-{
- // [ m00 m01 m02 ]
- // [ m10 m11 m12 ]
- // [ 0 0 1 ]
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::SetMatrixTraitL() - begin");
- iNative->SvgElementSetMatrixAttribute(
- aElementHandle,
- aAttributeType,
- aMatrix[ 0 ], // m00 - A
- aMatrix[ 1 ], // m10 - B
- aMatrix[ 2 ], // m01 - C
- aMatrix[ 3 ], // m11 - D
- aMatrix[ 4 ], // m02 - E
- aMatrix[ 5 ]); // m12 - F
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::SetMatrixTraitL() - end");
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::SetMediaTimeL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::SetMediaTimeL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- const TReal32& aSeconds)
-{
- M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::SetMediaTimeL() %f - begin", aSeconds);
- iNative->SvgDocumentSetMediaTime(aDocumentHandle, aSeconds);
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::SetMediaTimeL() - end");
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::SetPathTraitL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::SetPathTraitL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgAttrType& aAttributeType,
- const TM2GSvgPathHandle& aPathHandle)
-{
- iNative->SvgElementSetPathAttribute(
- aElementHandle,
- aAttributeType,
- aPathHandle);
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::SetRectTraitL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::SetRectTraitL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgAttrType& aAttributeType,
- const TM2GRectData& aRect)
-{
- iNative->SvgElementSetRectAttribute(
- aElementHandle,
- aAttributeType,
- aRect[ 0 ], // aX
- aRect[ 1 ], // aY
- aRect[ 2 ], // aWidth
- aRect[ 3 ]); // aHeight
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::SetRenderingQualityL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::SetRenderingQualityL(
- const TM2GSvgDocumentHandle& aEngineHandle,
- TInt aMode)
-{
- iNative->SvgEngineSetRenderQuality(aEngineHandle, aMode);
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::SetStringTraitL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::SetStringTraitL(
- const TM2GSvgElementHandle& aElementHandle,
- const TM2GSvgAttrType& aAttributeTypeId,
- const TPtrC16& aStr)
-{
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::SetStringTraitL() - begin");
- iNative->SvgElementSetStringAttribute(
- aElementHandle,
- aAttributeTypeId,
- aStr);
- M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::SetStringTraitL(): str sz:%d - end", aStr.Length());
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::SetViewportWidthL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::SetViewportWidthL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- TInt aWidth)
-{
- M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::SetViewportWidthL(): %d - begin", aWidth);
- iNative->SvgDocumentSetViewportWidth(aDocumentHandle, aWidth);
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::SetViewportWidthL() - end");
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::SetViewportHeightL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::SetViewportHeightL(
- const TM2GSvgDocumentHandle& aDocumentHandle,
- TInt aHeight)
-{
- M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::SetViewportHeightL(): %d - begin", aHeight);
- iNative->SvgDocumentSetViewportHeight(aDocumentHandle, aHeight);
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::SetViewportHeightL() - end");
-}
-
-// == PROTECTED METHODS ==
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::CloseContainers
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::CloseContainers()
-{
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::CloseContainers() - begin");
- if (iNative)
- {
- // Clear document container
- TInt count = iSvgDocuments.Count();
- M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::CloseContainers() - document count=%d", count);
- for (TInt index = 0; index < count; index++)
- {
- iNative->SvgDocumentDestroy(iSvgDocuments[index]);
- }
- iSvgDocuments.Reset();
- iSvgDocuments.Close();
- // Clear engine container
- count = iSvgEngines.Count();
- M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::CloseContainers() - engine count=%d", count);
- for (TInt index = 0; index < count; index++)
- {
- iNative->SvgEngineDestroy(iSvgEngines[index]);
- }
- iSvgEngines.Reset();
- iSvgEngines.Close();
- }
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::CloseContainers() - end");
-}
-
-// == PRIVATE METHODS ==
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::CM2GSVGProxy
-// -----------------------------------------------------------------------------
-CM2GSVGProxy::CM2GSVGProxy()
- : CBase(),
- iNative(NULL),
- iSvgEngines(),
- iSvgDocuments()
-{
- iSvgEngines.Compress();
- iSvgDocuments.Compress();
-}
-
-// -----------------------------------------------------------------------------
-// CM2GSVGProxy::ConstructL
-// -----------------------------------------------------------------------------
-void CM2GSVGProxy::ConstructL()
-{
- M2G_DEBUG_0("M2G_DEBUG: CM2GSVGProxy::ConstructL() - begin");
-
- //Get the font spec with variant default font
- const TInt KApacFontId = EApacPlain16;
- const TInt KLatintFontId = ELatinBold12;
- TInt fontId = KLatintFontId;
-
- switch (AknLayoutUtils::Variant())
- {
- case EApacVariant:
- {
- fontId = KApacFontId;
- }
- break;
-
- case EEuropeanVariant:
- default:
- break;
- }
-
- const CFont* font = AknLayoutUtils::FontFromId(fontId);
- TFontSpec spec = font->FontSpecInTwips();
-
- iNative = CSvgJavaInterfaceImpl::NewL(spec);
- M2G_DEBUG_1("M2G_DEBUG: CM2GSVGProxy::ConstructL() - SVGTopt created: %d", iNative);
-}
-
-M2G_NS_END
--- a/javauis/m2g_qt/src/CSynchronization.cpp Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,138 +0,0 @@
-/*
-* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: M2GCore function call synchronization for J9
-*
-*/
-
-// INCLUDE FILES
-#include "CSynchronization.h"
-
-NONSHARABLE_CLASS(M2gGlobals)
-{
-public:
- M2gGlobals() : mSync(0) {}
-
-public:
- CSynchronization* mSync;
-};
-
-#if defined(__WINSCW__)
-
-#include <pls.h>
-M2gGlobals* getM2gGlobals()
-{
- // Access the PLS of this process.
- //Todo have to check Uid for process.
- return Pls<M2gGlobals>(TUid::Uid(0x200211E2));
-}
-
-#else
-
-static M2gGlobals* sGlobals = 0;
-
-M2gGlobals* getM2gGlobals()
-{
- if (sGlobals == 0)
- {
- sGlobals = new M2gGlobals();
- }
- return sGlobals;
-}
-#endif
-
-
-// STATIC MEMBERS
-/*static*/ //CSynchronization* CSynchronization::iSelf = NULL;
-
-// -----------------------------------------------------------------------------
-// CSynchronization::InstanceL
-// -----------------------------------------------------------------------------
-/*static*/ CSynchronization* CSynchronization::InstanceL()
-{
- static M2gGlobals* globals = getM2gGlobals();
- if (!globals->mSync)
- {
- globals->mSync = CSynchronization::NewL();
- }
- return globals->mSync;
-}
-
-// -----------------------------------------------------------------------------
-// CSynchronization::NewL
-// -----------------------------------------------------------------------------
-/*static*/ CSynchronization* CSynchronization::NewL()
-{
- CSynchronization* self = new(ELeave) CSynchronization();
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop();
- return self;
-}
-
-// -----------------------------------------------------------------------------
-// CSynchronization::ConstructL
-// -----------------------------------------------------------------------------
-void CSynchronization::ConstructL()
-{
- User::LeaveIfError(iGuard.CreateLocal());
-}
-
-// -----------------------------------------------------------------------------
-// CSynchronization::CSynchronization
-// -----------------------------------------------------------------------------
-CSynchronization::CSynchronization() : iErrorCode(0)
-{
-}
-
-// -----------------------------------------------------------------------------
-// CSynchronization::~CSynchronization
-// -----------------------------------------------------------------------------
-CSynchronization::~CSynchronization()
-{
- iGuard.Close();
-}
-
-// -----------------------------------------------------------------------------
-// CSynchronization::Lock
-// -----------------------------------------------------------------------------
-void CSynchronization::Lock()
-{
- iGuard.Wait();
- iErrorCode = 0;
-}
-
-// -----------------------------------------------------------------------------
-// CSynchronization::Unlock
-// -----------------------------------------------------------------------------
-void CSynchronization::Unlock()
-{
- iErrorCode = 0;
- iGuard.Signal();
-}
-
-// -----------------------------------------------------------------------------
-// CSynchronization::SetErrorCode
-// -----------------------------------------------------------------------------
-void CSynchronization::SetErrorCode(TInt aCode)
-{
- iErrorCode = aCode;
-}
-
-// -----------------------------------------------------------------------------
-// CSynchronization::GetErrorCode
-// -----------------------------------------------------------------------------
-TInt CSynchronization::GetErrorCode()
-{
- return iErrorCode;
-}
--- a/javauis/m2g_qt/src/M2GGeneral.cpp Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,287 +0,0 @@
-/*
-* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: General methods
-*
-*/
-
-// INCLUDE FILES
-#include <s32strm.h> // RWriteStream
-
-
-#ifdef M2G_INFO_POPUP
-#include <eikenv.h> // CEikonEnv::InfoWinL
-#endif
-
-#include <jni.h>
-
-#include <SvgJavaInterfaceImpl.h>
-#include "M2GGeneral.h"
-
-
-M2G_NS_START
-
-// EXTERNAL DATA STRUCTURES
-
-// EXTERNAL FUNCTION PROTOTYPES
-
-// CONSTANTS
-
-// MACROS
-
-// LOCAL CONSTANTS AND MACROS
-
-// MODULE DATA STRUCTURES
-
-// LOCAL FUNCTION PROTOTYPES
-
-// FORWARD DECLARATIONS
-
-// -----------------------------------------------------------------------------
-// M2GGeneral::RaiseException
-// -----------------------------------------------------------------------------
-void M2GGeneral::RaiseException(
- JNIEnv* aEnv, const TDesC8& aName, const TUint8* aMsg)
-{
- M2G_DEBUG_0("#### M2G_DEBUG: M2GGeneral::RaiseException() ####");
-
- if (aEnv)
- {
- jclass clazz = aEnv->FindClass(
- REINTERPRET_CAST(const char*, aName.Ptr()));
-
- if (!clazz)
- {
- // if exception class not found, then use java.lang.Exception
- clazz = aEnv->FindClass(
- REINTERPRET_CAST(const char*, KJavaExceptionClass().Ptr()));
- }
-
- aEnv->ThrowNew(clazz, REINTERPRET_CAST(const char*, aMsg));
- }
-}
-
-// -----------------------------------------------------------------------------
-// M2GGeneral::CheckErrorCode
-// -----------------------------------------------------------------------------
-TInt M2GGeneral::CheckErrorCode(JNIEnv* aEnv, TInt aErrorCode)
-{
- M2G_DEBUG_1("M2G_DEBUG: M2GGeneral::CheckErrorCode: %d - begin", aErrorCode);
- TInt code = aErrorCode;
- const TUint8* msg = (STATIC_CAST(const TDesC8&, KM2GEmptyString8)).Ptr();
- jcfcommon::auto_ptr<MJavaError> error;
-
- // Check if an error object
- if (aErrorCode > 0)
- {
- M2G_DEBUG_0("M2G_DEBUG: M2GGeneral::CheckErrorCode(), is MJavaError");
-
- // Error object need to be deleted here and the auto_ptr takes care of that!!
- error.reset(JavaUnhand< MJavaError >(aErrorCode));
-
- // Get an error description through the MJavaError object
- msg = error->Description().Ptr();
-
- switch (error->ErrorCode())
- {
- case KM2GIOException:
- {
- code = error->ErrorCode();
- }
- default:
- {
- code = error->ErrorCode();
- }
- }
- M2G_DEBUG_1("M2G_DEBUG: M2GGeneral::CheckErrorCode(), MJavaError: error code=%d", code);
- }
-
- switch (code)
- {
- case KM2GMemoryNotOk:
- {
- M2G_DEBUG_0("#### M2G_DEBUG: M2GGeneral::CheckErrorCode() - OutOfMemoryError ####");
- M2GGeneral::RaiseException(aEnv, KJavaOutOfMemoryErrorClass, msg);
- return code;
- }
- case KM2GIOException:
- {
- M2G_DEBUG_0("#### M2G_DEBUG: M2GGeneral::CheckErrorCode() - IOException ####");
- M2GGeneral::RaiseException(aEnv, KJavaIOExceptionClass, msg);
- return code;
- }
- case KM2GHandleNotOk:
- {
- M2G_DEBUG_0("#### M2G_DEBUG: M2GGeneral::CheckErrorCode() - NullPointerException ####");
- M2GGeneral::RaiseException(aEnv, KJavaNullPointerException, msg);
- return code;
- }
- default:
- {
- M2G_DEBUG_1("M2G_DEBUG: M2GGeneral::CheckErrorCode() error code=%d - end", code);
- return code;
- }
- }
-}
-
-// -----------------------------------------------------------------------------
-// M2GGeneral::CheckHandle
-// -----------------------------------------------------------------------------
-TInt M2GGeneral::CheckHandle(JNIEnv* aEnv, TInt aHandle)
-{
- if (aHandle == M2G_INVALID_HANDLE)
- {
- M2GGeneral::RaiseException(aEnv, KJavaNullPointerException);
- }
- if (aHandle < 0)
- {
- M2GGeneral::CheckErrorCode(aEnv, aHandle);
- }
- return aHandle;
-}
-
-// -----------------------------------------------------------------------------
-// M2GGeneral::CheckErrorCodeAndHandle
-// -----------------------------------------------------------------------------
-TInt M2GGeneral::CheckErrorCodeAndHandle(
- JNIEnv* aEnv, TInt aErrorCode, TInt aHandle, TInt aErrorResult)
-{
- if ((aErrorCode == KM2GOk) && (aHandle != M2G_INVALID_HANDLE))
- {
- return aHandle;
- }
- if (aErrorCode != KM2GOk)
- {
- M2GGeneral::CheckErrorCode(aEnv, aErrorCode);
- }
- else if (aHandle == M2G_INVALID_HANDLE)
- {
- M2GGeneral::RaiseException(aEnv, KJavaOutOfMemoryErrorClass);
- }
- return aErrorResult;
-}
-
-// -----------------------------------------------------------------------------
-// M2GGeneral::PopupInfo
-// -----------------------------------------------------------------------------
-#ifdef M2G_INFO_POPUP
-void M2GGeneral::PopupInfo(
- const TDesC& aLine1,
- const TDesC& aLine2)
-{
- TInt err = KM2GOk;
- TRAP(err, CEikonEnv::InfoWinL(aLine1, aLine2));
- if (err == KM2GOk)
- {
- // DUMMY
- }
-}
-#endif // M2G_INFO_POPUP
-
-
-#ifdef M2G_STATISTIC_DEBUG
-// -----------------------------------------------------------------------------
-// M2GGeneral::TM2GStatistic::TM2GStatistic
-// -----------------------------------------------------------------------------
-M2GGeneral::TM2GStatistic::TM2GStatistic()
-{
- Reset();
-}
-
-// -----------------------------------------------------------------------------
-// M2GGeneral::TM2GStatistic::Reset()
-// -----------------------------------------------------------------------------
-void M2GGeneral::TM2GStatistic::Reset()
-{
- // Time
- iStartTime.UniversalTime();
- iEndTime.UniversalTime();
- // Thread
- iId = RThread().Id();
- RThread thread;
- if (thread.Open(iId) == KM2GOk)
- {
- iThreadName = thread.Name();
- thread.Close();
- }
-}
-
-// -----------------------------------------------------------------------------
-// M2GGeneral::TM2GStatistic::Print()
-// -----------------------------------------------------------------------------
-void M2GGeneral::TM2GStatistic::Print(TBool aPrintElapsedTime)
-{
- TInt totalRom = 0;
- TInt totalRam = 0;
- TInt freeRam = 0;
- HAL::Get(HALData::EMemoryROM, totalRom);
- HAL::Get(HALData::EMemoryRAM, totalRam);
- HAL::Get(HALData::EMemoryRAMFree, freeRam);
-
- // Update time
- iEndTime.UniversalTime();
-
- M2G_DEBUG_0("====================================================");
- // Write memory info
- if (aPrintElapsedTime)
- {
- M2G_DEBUG_5(
- "Rom size:%d, ram size:%d, ram free:%d, ram used:%d, elapsed time:%d",
- totalRom >> 10,
- totalRam >> 10,
- freeRam >> 10,
- (totalRam - freeRam) >> 10,
- iEndTime.MicroSecondsFrom(iStartTime).Int64());
- }
- else
- {
- M2G_DEBUG_4(
- "Rom size:%d, ram size:%d, ram free:%d, ram used:%d",
- totalRom >> 10,
- totalRam >> 10,
- freeRam >> 10,
- (totalRam - freeRam) >> 10);
- }
- // Write thread info
- RThread thread;
- if (thread.Open(iId) == KM2GOk)
- {
- TThreadStackInfo stackInfo;
- thread.StackInfo(stackInfo);
- thread.Close();
- TUint id = iId;
- M2G_DEBUG_2("Thread id:%d, size:%d", id, (stackInfo.iBase - stackInfo.iLimit) >> 10);
- }
- M2G_DEBUG_0("====================================================");
-}
-
-// -----------------------------------------------------------------------------
-// M2GGeneral::TM2GStatistic::Print()
-// -----------------------------------------------------------------------------
-void M2GGeneral::TM2GStatistic::Print(RWriteStream& /*aStream*/)
-{
-}
-
-// -----------------------------------------------------------------------------
-// M2GGeneral::TM2GStatistic::Log()
-// -----------------------------------------------------------------------------
-void M2GGeneral::TM2GStatistic::Log()
-{
- M2G_DEBUG_0("M2GGeneral::TM2GStatistic::Log()");
- M2GGeneral::TM2GStatistic statistic;
- statistic.Print();
-}
-
-#endif // M2G_STATISTIC_DEBUG
-
-M2G_NS_END
--- a/javauis/m2g_qt/src/M2GUtils.cpp Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,346 +0,0 @@
-/*
-* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Util methods
-*
-*/
-
-// INCLUDE FILES
-#include <bitdev.h> // CFbsBitmapDevice
-#include <bitstd.h> // CFbsBitGc
-#include <e32math.h> // FRand
-#include "M2GUtils.h"
-
-
-M2G_NS_START
-
-// EXTERNAL DATA STRUCTURES
-
-// EXTERNAL FUNCTION PROTOTYPES
-
-// CONSTANTS
-
-// MACROS
-
-// LOCAL CONSTANTS AND MACROS
-
-// MODULE DATA STRUCTURES
-
-// LOCAL FUNCTION PROTOTYPES
-
-// FORWARD DECLARATIONS
-class TSWTBitBlt;
-class TM2GBitmapLock;
-// -----------------------------------------------------------------------------
-// M2GBitmapUtils::BitBlt
-// -----------------------------------------------------------------------------
-TInt M2GBitmapUtils::BitBlt(CFbsBitmap& aTarget,
- const CFbsBitmap& aSource,
- const TPoint& aPoint,
- const TRect* aRect,
- const CFbsBitmap* aSourceMask)
-{
- M2G_DEBUG_2("M2G_DEBUG: M2GBitmapUtils::BitBlt() - Point(x=%d, y=%d)", aPoint.iX, aPoint.iY);
- CFbsBitGc* context = NULL;
- CFbsBitmapDevice* device = NULL;
- TInt err = KM2GOk;
- TRAP(err, (device = CFbsBitmapDevice::NewL(&aTarget)));
- if ((err == KM2GOk) && (device != NULL))
- {
- err = device->CreateContext(context);
- if ((err == KM2GOk) && (context != NULL))
- {
- M2G_DEBUG_0("M2G_DEBUG: M2GBitmapUtils::BitBlt() - CFbsBitGc::BitBlt()");
- if (aRect)
- {
- // Check if mask
- if (aSourceMask)
- {
- M2G_DEBUG_4("M2G_DEBUG: M2GBitmapUtils::BitBlt() - mask rect(x1=%d, y1=%d, x2=%d, y2=%d)", aRect->iTl.iX, aRect->iTl.iY, aRect->iBr.iX, aRect->iBr.iY);
- // A pixel that is masked by a BLACK is NOT transferred to a destination rectangle.
- context->BitBltMasked(aPoint, &aSource, *aRect, aSourceMask, ETrue);
- err = KM2GOk;
- }
- else
- {
- M2G_DEBUG_4("M2G_DEBUG: M2GBitmapUtils::BitBlt() - rect(x1=%d, y1=%d, x2=%d, y2=%d)", aRect->iTl.iX, aRect->iTl.iY, aRect->iBr.iX, aRect->iBr.iY);
- context->BitBlt(aPoint, &aSource, *aRect);
- err = KM2GOk;
- }
- }
- else
- {
- M2G_DEBUG_0("M2G_DEBUG: M2GBitmapUtils::BitBlt() - no rect");
- context->BitBlt(aPoint, &aSource);
- err = KM2GOk;
- }
- }
- }
- delete context;
- delete device;
- context = NULL;
- device = NULL;
- M2G_DEBUG_1("M2G_DEBUG: M2GBitmapUtils::BitBlt() - end: %d", err);
- return err;
-}
-
-
-TInt M2GBitmapUtils::BitQBlt(QImage& aTargetQimage,
- const QImage& aSourceQimage,
- const TPoint& aPoint,
- const TRect* aRect,
- const CFbsBitmap* aSourceMask)
-{
- M2G_DEBUG_2("M2G_DEBUG: M2GBitmapUtils::BitQBlt() - Point(x=%d, y=%d)", aPoint.iX, aPoint.iY);
-
- QPixmap pixmapTarget = QPixmap::fromImage(aTargetQimage);
- CFbsBitmap* aTarget = pixmapTarget.toSymbianCFbsBitmap();
-
- QPixmap pixmapSource = QPixmap::fromImage(aSourceQimage);
- CFbsBitmap* aSource = pixmapSource.toSymbianCFbsBitmap();
-
- CFbsBitGc* context = NULL;
- CFbsBitmapDevice* device = NULL;
- TInt err = KM2GOk;
- TRAP(err, (device = CFbsBitmapDevice::NewL(aTarget)));
- if ((err == KM2GOk) && (device != NULL))
- {
- err = device->CreateContext(context);
- if ((err == KM2GOk) && (context != NULL))
- {
- M2G_DEBUG_0("M2G_DEBUG: M2GBitmapUtils::BitBlt() - CFbsBitGc::BitBlt()");
- if (aRect)
- {
- // Check if mask
- if (aSourceMask)
- {
- M2G_DEBUG_4("M2G_DEBUG: M2GBitmapUtils::BitBlt() - mask rect(x1=%d, y1=%d, x2=%d, y2=%d)", aRect->iTl.iX, aRect->iTl.iY, aRect->iBr.iX, aRect->iBr.iY);
- // A pixel that is masked by a BLACK is NOT transferred to a destination rectangle.
- context->BitBltMasked(aPoint, aSource, *aRect, aSourceMask, ETrue);
- err = KM2GOk;
- }
- else
- {
- M2G_DEBUG_4("M2G_DEBUG: M2GBitmapUtils::BitBlt() - rect(x1=%d, y1=%d, x2=%d, y2=%d)", aRect->iTl.iX, aRect->iTl.iY, aRect->iBr.iX, aRect->iBr.iY);
- context->BitBlt(aPoint, aSource, *aRect);
- err = KM2GOk;
- }
- }
- else
- {
- M2G_DEBUG_0("M2G_DEBUG: M2GBitmapUtils::BitBlt() - no rect");
- context->BitBlt(aPoint, aSource);
- err = KM2GOk;
- }
- }
- }
- delete context;
- delete device;
- context = NULL;
- device = NULL;
- M2G_DEBUG_1("M2G_DEBUG: M2GBitmapUtils::BitBlt() - end: %d", err);
- return err;
-}
-
-
-
-TInt M2GBitmapUtils::BitBlt(CBitmapContext& aTargetContext,
- const CFbsBitmap& aSource,
- const TPoint& aPoint,
- const TRect* aRect,
- const CFbsBitmap* aSourceMask,
- /*MSwtClient* aClientHandle,*/
- TBool aUseNativeClear /*= EFalse*/)
-{
- M2G_DEBUG_2("M2G_DEBUG: M2GBitmapUtils::BitBlt() - Point(x=%d, y=%d)", aPoint.iX, aPoint.iY);
- TInt err = KM2GOk;
- TSWTBitBlt bitBlitter(aTargetContext, aPoint,
- &aSource, aRect, aSourceMask, aUseNativeClear);
- bitBlitter();
- M2G_DEBUG_1("M2G_DEBUG: M2GBitmapUtils::BitBlt() - end: %d", err);
- return err;
-}
-
-// -----------------------------------------------------------------------------
-// TM2GRenderRect::TM2GRenderRect
-// -----------------------------------------------------------------------------
-TM2GRenderRect::TM2GRenderRect(
- TInt aAnchorX, TInt aAnchorY,
- TInt aClipX, TInt aClipY,
- TInt aClipW, TInt aClipH)
- : TRect(
- TPoint(aClipX, aClipY),
- TSize(aClipW, aClipH)),
- iAnchorX(aAnchorX),
- iAnchorY(aAnchorY)
-{
-}
-
-// -----------------------------------------------------------------------------
-// TM2GRenderRect::TM2GRenderRect
-// -----------------------------------------------------------------------------
-TM2GRenderRect::TM2GRenderRect(TInt* aDimensions, TInt /*aLength*/)
- : TRect(
- TPoint(aDimensions[EClipX], aDimensions[EClipY]),
- TSize(aDimensions[EClipW], aDimensions[EClipH])),
- iAnchorX(aDimensions[EAnchorX]),
- iAnchorY(aDimensions[EAnchorY])
-{
-}
-
-// -----------------------------------------------------------------------------
-// TM2GRenderRect::~TM2GRenderRect
-// -----------------------------------------------------------------------------
-TM2GRenderRect::~TM2GRenderRect()
-{
-}
-
-// -----------------------------------------------------------------------------
-// TM2GRenderRect::TM2GRenderRect
-// -----------------------------------------------------------------------------
-TM2GRenderRect::TM2GRenderRect(const TM2GRenderRect& aRd)
-{
- (*this = aRd);
-}
-
-// -----------------------------------------------------------------------------
-// TM2GRenderRect::operator=
-// -----------------------------------------------------------------------------
-TM2GRenderRect& TM2GRenderRect::operator=(const TM2GRenderRect& aRd)
-{
- if (this != &aRd)
- {
- iAnchorX = aRd.iAnchorX;
- iAnchorY = aRd.iAnchorY;
- SetRect(aRd.iTl.iX, aRd.iTl.iY, aRd.iBr.iX, aRd.iBr.iY);
- }
- return *this;
-}
-
-// -----------------------------------------------------------------------------
-// TM2GRenderRect::GetRegionSizeInPixels
-// -----------------------------------------------------------------------------
-TSize TM2GRenderRect::GetRegionSizeInPixels(
- TM2GRenderRect& aRect,
- const TSize& aSz)
-{
- return TSize(
- // determine the width of the region to be paint
- M2GGeneral::Min< TInt >(aRect.GetAnchorX() + aSz.iWidth, aRect.GetClipX() + aRect.GetClipW()) -
- M2GGeneral::Max< TInt >(aRect.GetAnchorX(), aRect.GetClipX()),
- // determine the height of the region to be paint
- M2GGeneral::Min< TInt >(aRect.GetAnchorY() + aSz.iHeight, aRect.GetClipY() + aRect.GetClipH()) -
- M2GGeneral::Max< TInt >(aRect.GetAnchorY(), aRect.GetClipY()));
-}
-
-
-// -----------------------------------------------------------------------------
-// TM2GBitmapLock::TM2GBitmapLock
-// -----------------------------------------------------------------------------
-TM2GBitmapLock::TM2GBitmapLock(const CFbsBitmap* aBitmap, TBool aLock)
- : iBitmap(aBitmap), iIsLocked(EFalse)
-{
- if (aLock)
- {
- Lock();
- }
-}
-
-// -----------------------------------------------------------------------------
-// TM2GBitmapLock::~TM2GBitmapLock
-// -----------------------------------------------------------------------------
-TM2GBitmapLock::~TM2GBitmapLock()
-{
- Unlock();
-}
-
-// -----------------------------------------------------------------------------
-// TM2GBitmapLock::Lock()
-// -----------------------------------------------------------------------------
-void TM2GBitmapLock::Lock()
-{
- if (iBitmap && !iIsLocked)
- {
- iBitmap->LockHeap();
- iIsLocked = ETrue;
- }
-}
-
-// -----------------------------------------------------------------------------
-// TM2GBitmapLock::Unlock()
-// -----------------------------------------------------------------------------
-void TM2GBitmapLock::Unlock()
-{
- if (iBitmap && iIsLocked)
- {
- iBitmap->UnlockHeap();
- iIsLocked = EFalse;
- }
-}
-
-TSWTBitBlt::TSWTBitBlt(CBitmapContext& aTargetContext,
- const TPoint& aPoint,
- const CFbsBitmap* aBitmap,
- const TRect* aSourceRect,
- const CFbsBitmap* aMaskBitmap,
- TBool aUseNativeClear)
- : iTargetContext(aTargetContext),
- iPoint(aPoint),
- iUseNativeClear(aUseNativeClear)
-{
- iBitmap = aBitmap;
- iRect = aSourceRect;
- iMaskBitmap = aMaskBitmap;
-}
-void TSWTBitBlt::operator()() const
-{
- M2G_DEBUG_0("TSWTBitBlt()+");
- CFbsBitmap* tempBitmap = new(ELeave) CFbsBitmap;
- CleanupStack::PushL(tempBitmap);
- User::LeaveIfError(tempBitmap->Duplicate(iBitmap->Handle()));
- if (iRect)
- {
- if (iUseNativeClear)
- {
- iTargetContext.SetBrushColor(KRgbWhite);
- iTargetContext.Clear(*iRect);
- }
- if (iMaskBitmap)
- {
- CFbsBitmap* tempMask = new(ELeave) CFbsBitmap;
- CleanupStack::PushL(tempMask);
- User::LeaveIfError(tempMask->Duplicate(iMaskBitmap->Handle()));
- iTargetContext.BitBltMasked(
- iPoint, tempBitmap, *iRect, tempMask, ETrue);
- CleanupStack::PopAndDestroy(tempMask);
- }
- else
- {
- iTargetContext.BitBlt(iPoint, tempBitmap, *iRect);
- }
- }
- else
- {
- if (iUseNativeClear)
- {
- iTargetContext.SetBrushColor(KRgbWhite);
- iTargetContext.Clear();
- }
- iTargetContext.BitBlt(iPoint, tempBitmap);
- }
- CleanupStack::PopAndDestroy(tempBitmap);
- M2G_DEBUG_0("TSWTBitBlt()-");
-}
-//TODO Check for M2G_DO_LOCK M2G_DO_UNLOCK
-//TODO Put Check for aSvgProxyHandle in all the functions.
-M2G_NS_END
--- a/javauis/m2g_qt/src/jni/M2GDocument.cpp Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,442 +0,0 @@
-/*
-* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: JNI methods
-*
-*/
-
-// INCLUDE FILES
-#include "CM2GEventSource.h"
-#include "com_nokia_microedition_m2g_M2GDocument.h"
-#include "MM2GSVGProxy.h"
-
-M2G_NS_START
-
-// EXTERNAL DATA STRUCTURES
-
-// EXTERNAL FUNCTION PROTOTYPES
-
-// CONSTANTS
-
-// MACROS
-
-// LOCAL CONSTANTS AND MACROS
-
-// MODULE DATA STRUCTURES
-
-// LOCAL FUNCTION PROTOTYPES
-
-// FORWARD DECLARATIONS
-
-// CLASS DECLARATION
-
-// ================================ FUNCTIONS ==================================
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GDocument::_createDocument
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::CreateDocumentL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aData Document data
- * @param aHandle Document handle to be returned
- * @throws Exception if not ok
-*/
-JNIEXPORT jint JNICALL
-Java_com_nokia_microedition_m2g_M2GDocument__1createDocument(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jstring aData)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GDocument ) _createDocument - begin");
-
- TInt handle = M2G_INVALID_HANDLE;
- TInt err = KM2GNotOk;
- RJString data(*aJni, aData);
- TPtrC16* bData = STATIC_CAST(TPtrC16*, &data);
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
- TRAP(err,aProxy->CreateDocumentL(*bData, handle););
- }
- M2G_DO_UNLOCK(aJni)
-
- handle = M2GGeneral::CheckErrorCodeAndHandle(aJni, err, handle, M2G_INVALID_HANDLE);
- M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GDocument ) _createDocument: %d - end", handle);
- return handle;
-}
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GDocument::_createElementNS
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::CreateElementNsL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aType Element type id.
- * @param aDocumentHandle Document handle.
- * @param aHandle Element handle to be returned
- * @throws Exception if not ok
- */
-JNIEXPORT jint JNICALL
-Java_com_nokia_microedition_m2g_M2GDocument__1createElementNS(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jshort aType,
- jint aDocumentHandle)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GDocument ) _createElementNS - begin");
-
- // Execute native engine method
- TInt handle = M2G_INVALID_HANDLE;
- TInt err = KM2GNotOk;
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
- TRAP(err,aProxy->CreateElementNsL(
- aType,
- aDocumentHandle,
- handle); );
-
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
- M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GDocument ) _createElementNS: %d - end", handle);
- return handle;
-}
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GDocument::_deleteDocument
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::DeleteDocumentL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aDocumentHandle Document handle
- * @throws Exception if not ok
- */
-JNIEXPORT void JNICALL
-Java_com_nokia_microedition_m2g_M2GDocument__1deleteDocument(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aDocumentHandle )
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GDocument ) _deleteDocument - begin");
- TInt err = KM2GNotOk;
-
- M2G_DO_LOCK
- // Extract the SVGProxy handle
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
- TRAP(err,aProxy->DeleteDocumentL(aDocumentHandle););
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GDocument ) _deleteDocument - end");
-}
-
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GDocument::_getElementById
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::GetElementByIdL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aDocumentHandle Document pointer.
- * @param aId Element ID.
- * @param aHandle Element handle to be returned.
- */
-JNIEXPORT jint JNICALL
-Java_com_nokia_microedition_m2g_M2GDocument__1getElementById(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aDocumentHandle,
- jstring aId)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GDocument ) _getElementById - begin");
- TInt handle = M2G_INVALID_HANDLE;
- TInt err = KM2GNotOk;
- RJString id(*aJni, aId);
- TPtrC16* lId = STATIC_CAST(TPtrC16*, &id);
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
- TRAP(err,aProxy->GetElementByIdL(aDocumentHandle, *lId, handle););
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
-
- M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GDocument ) _getElementById: %d - end", handle);
- return handle;
-}
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GDocument::_getViewportHeight
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::GetViewportHeightL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aDocumentHandle Document pointer.
- * @param aHeight Height to be returned.
- */
-JNIEXPORT jint JNICALL
-Java_com_nokia_microedition_m2g_M2GDocument__1getViewportHeight(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aDocumentHandle)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GDocument ) _getViewportHeight - begin");
- TInt err = KM2GNotOk;
- TInt height = 0;
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
- TRAP(err,aProxy->GetViewportHeightL(aDocumentHandle, height););
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
-
- M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GDocument ) _getViewportHeight: %d - end", height);
- return height;
-}
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GDocument::_getViewportWidth
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::GetViewportWidthL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aDocumentHandle Document pointer.
- * @param aWidth Width to be returned.
- * Class: com_nokia_microedition_m2g_M2GDocument
- * Method: _getViewportWidth
- * Signature:
- */
-JNIEXPORT jint JNICALL
-Java_com_nokia_microedition_m2g_M2GDocument__1getViewportWidth(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aDocumentHandle)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GDocument ) _getViewportWidth - begin");
- TInt err = KM2GNotOk;
- TInt width = 0;
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
- TRAP(err,aProxy->GetViewportWidthL(aDocumentHandle, width););
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
-
- M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GDocument ) _getViewportWidth: %d - end", width);
- return width;
-}
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GDocument::_isElementInDom
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::IsElementInDomL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aDocumentHandle Document pointer.
- * @param aElementHandle Element pointer.
- * @param aIsElementInDom Result
- */
-JNIEXPORT jint JNICALL
-Java_com_nokia_microedition_m2g_M2GDocument__1isElementInDOM(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aDocumentHandle,
- jint aElementHandle)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI _isElementInDOM - begin");
- TInt isElementInDom = -1;
- TInt err = KM2GNotOk;
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
- TRAP(err,aProxy->IsElementInDomL(
- aDocumentHandle, aElementHandle, isElementInDom););
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
-
- M2G_DEBUG_1("M2G_DEBUG: JNI _isElementInDOM: %d - end", isElementInDom);
- return isElementInDom;
-}
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GDocument::_requestCompleted
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::RequestCompletedL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aDocumentHandle Document pointer.
- * @param aURI Resource uri
- * @param aResourceData Resource data
- * @param aCompleted Result
- */
-JNIEXPORT jint JNICALL
-Java_com_nokia_microedition_m2g_M2GDocument__1requestCompleted(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aDocumentHandle,
- jstring aURI,
- jbyteArray aResourceData)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GDocument ) _requestCompleted - begin");
-
- RJString uri(*aJni, aURI);
- TInt err = KM2GNotOk;
- TPtrC8 lResData8;
- jbyte* resBytes = NULL;
-
- if (aResourceData)
- {
- resBytes = aJni->GetByteArrayElements(aResourceData, NULL);
- lResData8.Set(REINTERPRET_CAST(TUint8*, resBytes), aJni->GetArrayLength(aResourceData));
- }
-
- TInt completed = -1;
- TPtrC16* pUri = STATIC_CAST(TPtrC16*, &uri);
-
- M2G_DO_LOCK
-
- if (aSvgProxyHandle)
- {
-
- MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
-
- TRAP(err, aProxy->RequestCompletedL(
- aDocumentHandle,
- *pUri,
- lResData8,
- completed););
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
- if (aResourceData)
- {
- aJni->ReleaseByteArrayElements(aResourceData, resBytes, JNI_ABORT); // don't copy back
- }
-
- M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GDocument ) _requestCompleted: %d - end", completed);
-
- return completed;
-}
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GDocument::_setViewportHeight
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::SetViewportHeightL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aDocumentHandle Document pointer.
- * @param aHeight Height
- * JNI method
- */
-JNIEXPORT void JNICALL
-Java_com_nokia_microedition_m2g_M2GDocument__1setViewportHeight(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aDocumentHandle,
- jint aHeight)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GDocument ) _setViewportHeight - begin");
- TInt err = KM2GNotOk;
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
- TRAP(err,aProxy->SetViewportHeightL(
- (TM2GSvgDocumentHandle)aDocumentHandle, aHeight););
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
-
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GDocument ) _setViewportHeight - end");
-}
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GDocument::_setViewportWidth
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::SetViewportWidthL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aDocumentHandle Document pointer.
- * @param aWidth Width
- * JNI method
- */
-JNIEXPORT void JNICALL
-Java_com_nokia_microedition_m2g_M2GDocument__1setViewportWidth(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aDocumentHandle,
- jint aWidth)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GDocument ) _setViewportWidth - begin");
- TInt err = KM2GNotOk;
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
- TRAP(err, aProxy->SetViewportWidthL(
- (TM2GSvgDocumentHandle)aDocumentHandle, aWidth););
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GDocument ) _setViewportWidth - end");
-}
-
-M2G_NS_END
--- a/javauis/m2g_qt/src/jni/M2GManager.cpp Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,250 +0,0 @@
-/*
-* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: JNI methods
-*
-*/
-
-// INCLUDE FILES
-#include "CM2GEventSource.h"
-#include "com_nokia_microedition_m2g_M2GManager.h"
-#include "CM2GSVGProxy.h"
-#include "CM2GEventSource.h"
-
-M2G_NS_START
-
-// EXTERNAL DATA STRUCTURES
-
-// EXTERNAL FUNCTION PROTOTYPES
-
-// CONSTANTS
-
-// MACROS
-
-// LOCAL CONSTANTS AND MACROS
-
-// MODULE DATA STRUCTURES
-
-// LOCAL FUNCTION PROTOTYPES
-
-// FORWARD DECLARATIONS
-
-// CLASS DECLARATION
-
-// ================================ FUNCTIONS ==================================
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GManager::_createSvgEngine
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::CreateSvgEngineL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aHandle Svg engine handle
-*/
-/**
- * JNI method
- */
-JNIEXPORT jint JNICALL
-Java_com_nokia_microedition_m2g_M2GManager__1createSvgEngine(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GManager ) _createSvgEngine - begin");
-
- TInt handle = M2G_INVALID_HANDLE;
- TInt err = KM2GNotOk;
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- TRAP(err,JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle)->CreateSvgEngineL(handle););
- }
- M2G_DO_UNLOCK(aJni)
-
- handle = M2GGeneral::CheckErrorCodeAndHandle(
- aJni, err, handle, M2G_INVALID_HANDLE);
-
- M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GManager ) _createSvgEngine: %d - end", handle);
- return handle;
-}
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GManager::_createSvgProxy
-// -----------------------------------------------------------------------------
-/**
- * Creates an svg proxy.
- * @since Series S60 3.0
- * @param Svg proxy handle
-/**
- * JNI method
- */
-JNIEXPORT jint JNICALL
-Java_com_nokia_microedition_m2g_M2GManager__1createSvgProxy(
- JNIEnv* aJni,jclass)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GManager ) _createSvgProxy - begin");
- TInt handle = M2G_INVALID_HANDLE;
- TInt err = KM2GNotOk;
-
- M2G_DO_LOCK
- TRAP(err, MM2GSVGProxy* proxy = CM2GSVGProxy::NewL(); handle = JavaMakeHandle(proxy););
- M2G_DO_UNLOCK(aJni)
-
- handle = M2GGeneral::CheckErrorCodeAndHandle(aJni, err, handle, err);
- M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GManager ) _createSvgProxy: %d - end", handle);
- return handle;
-}
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GManager::_deleteSvgEngine
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::DeleteSvgEnginedL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
-
-/**
- * JNI method
- */
-JNIEXPORT void JNICALL
-Java_com_nokia_microedition_m2g_M2GManager__1deleteSvgEngine(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aSvgEngineHandle )
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GManager ) _deleteSvgEngine - begin");
-
- TInt err = KM2GNotOk;
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- TRAP(err,JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle)->DeleteSvgEngineL(
- STATIC_CAST(TM2GSvgEngineHandle, aSvgEngineHandle)););
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
-
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GManager ) _deleteSvgEngine: - end");
-}
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GManager::_deleteSvgProxy
-// -----------------------------------------------------------------------------
-/**
- * Deletes a proxy object. NOTE: The proxy object has to be deleted inside same
- * thread as it was created, otherwice there will be problem to delete a CFbsBitmap
- * server object inside the SVGTopt componenet see KATA-6KYA9T (SVGEngineJI: SVGTopt
- * crashes when deleting svg document object that contains external resource)
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
-
-/**
- * JNI method
- */
-JNIEXPORT void JNICALL
-Java_com_nokia_microedition_m2g_M2GManager__1deleteSvgProxy(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GManager ) _deleteSvgProxy - begin");
- TInt err = KM2GNotOk;
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy* proxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
- TRAP(err,delete proxy;);
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GManager ) _deleteSvgProxy: - end");
-}
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GManager::_finalizeEventSource
-// -----------------------------------------------------------------------------
-/**
- * JNI method TODO check this function for modifications
- */
-//JNIEXPORT void JNICALL
-//Java_com_nokia_microedition_m2g_M2GManager__1finalizeEventSource(
-// JNIEnv *aJni, jclass, jint aEventSourceHandle, jboolean aUiToolkit)
-//{
-// M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GManager ) _finalizeEventSource: %d", aEventSourceHandle);
-// if (aUiToolkit)
-// {
-//// MSwtClient* client = reinterpret_cast< MSwtClient* >(aEventSourceHandle);
-//// if (client)
-//// {
-//// delete client;
-//// client = NULL;
-//// }
-// }
-// else
-// {
-// CM2GEventSource* eventSource = JavaUnhand< CM2GEventSource >(aEventSourceHandle);
-// if (eventSource)
-// {
-// eventSource->Dispose(*aJni);
-// }
-// eventSource = NULL;
-// }
-//}
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GManager::_initEventSource
-// -----------------------------------------------------------------------------
-/**
- * JNI method TODO check this function for modifications
-
-JNIEXPORT jint JNICALL
-Java_com_nokia_microedition_m2g_M2GManager__1initEventSource(
- JNIEnv *aJni,
- jclass aPeer,
- jint aServer)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GManager ) _initEventSource - begin");
-
- M2G_DO_LOCK
- TRAPD(eventSourceHandle, eventSourceHandle = CM2GEventSource::NewL(
- *aJni, aPeer, aServer));
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckHandle(aJni, eventSourceHandle);
- M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GManager ) _initEventSource - end: %d", eventSourceHandle);
- return eventSourceHandle;
-}*/
-////TODO check this function for modifications
-//JNIEXPORT jint JNICALL
-//Java_com_nokia_microedition_m2g_M2GManager__1initSwtEventSource(
-// JNIEnv *aJni,
-// jclass /*aPeer*/)
-//{
-// M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GManager ) _initEventSource - begin");
-//
-// MSwtClient* client = NULL;
-// TRAP_IGNORE(client = SWT::CreateClientL());
-// if (!client)
-// {
-// return KErrNotFound;
-// }
-// M2GGeneral::CheckHandle(aJni, (int)client);
-// M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GManager ) _initEventSource - end: %d", eventSourceHandle);
-// return (int)client;
-//}
-M2G_NS_END
--- a/javauis/m2g_qt/src/jni/M2GSVGAnimationElement.cpp Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,176 +0,0 @@
-/*
-* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: JNI methods
-*
-*/
-
-// INCLUDE FILES
-#include "CM2GEventSource.h"
-#include "com_nokia_microedition_m2g_M2GSVGAnimationElement.h"
-#include "MM2GSVGProxy.h"
-
-M2G_NS_START
-
-// EXTERNAL DATA STRUCTURES
-
-// EXTERNAL FUNCTION PROTOTYPES
-
-// CONSTANTS
-
-// MACROS
-
-// LOCAL CONSTANTS AND MACROS
-
-// MODULE DATA STRUCTURES
-
-// LOCAL FUNCTION PROTOTYPES
-
-// FORWARD DECLARATIONS
-
-// CLASS DECLARATION
-
-// ================================ FUNCTIONS ==================================
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GSVGAnimationElement::_beginElementAt
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::BeginElementAtL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aDocumentHandle Document handle
- * @param aElementHandle Element handle
- * @param aOffset Offset time
- * @throws Exception if not ok.
- */
-JNIEXPORT void JNICALL
-Java_com_nokia_microedition_m2g_M2GSVGAnimationElement__1beginElementAt(
- JNIEnv* aJni,
- jobject,
- jint aSvgProxyHandle,
- jint aDocumentHandle,
- jint aElementHandle,
- jfloat aOffset,
- jfloat aCurrentTime)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGAnimationElement ) _beginElementAt - begin");
- TInt err = KM2GNotOk;
-
- if (aSvgProxyHandle && aDocumentHandle)
- {
- MM2GSVGProxy* aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle);
- TInt16 restartAttribute;
-
- TRAP(err, aProxy->GetEnumTraitL(
- STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
- STATIC_CAST(TM2GSvgAttrType, KM2GRestartAttribute),
- restartAttribute);
- )
-
- TInt isActive;
- TRAP(err, aProxy->IsActiveL(STATIC_CAST(TM2GSvgElementHandle, aElementHandle), isActive); )
-
- if (isActive && (restartAttribute == KM2GRestartWhenNotActive))
- {
- M2G_DEBUG_1("M2G_DEBUG: M2GSVGAnimationElement::DoBeginElementAtL() - active & restart att:%d", restartAttribute);
- }
- else if ((aCurrentTime != 0) && (restartAttribute == KM2GRestartNever))
- {
- // Cannot restart even if animation hasn't ended?
- M2G_DEBUG_1("M2G_DEBUG: M2GSVGAnimationElement::DoBeginElementAtL() - not active & restart att:%d", restartAttribute);
- }
- else
- {
- M2G_DEBUG_2("M2G_DEBUG: M2GSVGAnimationElement::DoBeginElementAtL() - offset:%f & current:%f", aOffset, aCurrentTime);
- TRAP(err, aProxy->BeginElementAtL(
- STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle),
- STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
- (aOffset+aCurrentTime) );
- )
- }
- }
- M2GGeneral::CheckErrorCode(aJni, err);
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGAnimationElement ) _beginElementAt - end");
-
-}
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GSVGAnimationElement::_endElementAt
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::EndElementAt method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aDocumentHandle Document handle
- * @param aElementHandle Element handle
- * @param aOffset Offset time
- */
-JNIEXPORT void JNICALL
-Java_com_nokia_microedition_m2g_M2GSVGAnimationElement__1endElementAt(
- JNIEnv* aJni,
- jobject,
- jint aSvgProxyHandle,
- jint aDocumentHandle,
- jint aElementHandle,
- jfloat aOffset)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGAnimationElement ) _endElementAt - begin");
- TInt err = KM2GNotOk;
-
- MM2GSVGProxy* aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle);
-
- TRAP(err, aProxy->EndElementAtL(STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle),
- STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
- aOffset);
- )
-
- M2GGeneral::CheckErrorCode(aJni, err);
-
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGAnimationElement ) _endElementAt - end");
-}
-
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GSVGAnimationElement::_isActive
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::EndElementAt method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aElementHandle Element handle
- */
-JNIEXPORT jboolean JNICALL
-Java_com_nokia_microedition_m2g_M2GSVGAnimationElement__1isActive(
- JNIEnv* aJni,
- jobject,
- jint aSvgProxyHandle,
- jint aElementHandle)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGAnimationElement ) _isActive - begin");
- TInt err = KM2GNotOk;
- TInt active = 0;
- MM2GSVGProxy* aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle);
-
- TRAP(err, aProxy->IsActiveL(
- STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
- active);
- )
-
- M2GGeneral::CheckErrorCode(aJni, err);
- M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGAnimationElement ) _isActive: %d - end", active);
- return STATIC_CAST(jboolean, (active == 1 ? ETrue : EFalse));
-}
-
-M2G_NS_END
-
-
--- a/javauis/m2g_qt/src/jni/M2GSVGElement.cpp Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1141 +0,0 @@
-/*
-* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: JNI methods
-*
-*/
-
-// INCLUDE FILES
-#include "CM2GEventSource.h"
-#include "com_nokia_microedition_m2g_M2GSVGElement.h"
-#include "MM2GSVGProxy.h"
-
-M2G_NS_START
-
-// EXTERNAL DATA STRUCTURES
-
-// EXTERNAL FUNCTION PROTOTYPES
-
-// CONSTANTS
-
-// MACROS
-
-// LOCAL CONSTANTS AND MACROS
-
-// MODULE DATA STRUCTURES
-
-// LOCAL FUNCTION PROTOTYPES
-
-// FORWARD DECLARATIONS
-
-// CLASS DECLARATION
-
-// ================================ FUNCTIONS ==================================
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GSVGElement::_appendChild
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::AppendChildL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aElementHandle Element handle
- * @param aChildElementHandle Child handle
- */
-JNIEXPORT void JNICALL
-Java_com_nokia_microedition_m2g_M2GSVGElement__1appendChild(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aElementHandle,
- jint aChildElementHandle)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _appendChild - begin");
- TInt err = KM2GNotOk;
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
- TRAP(err, aProxy->AppendChildL(
- STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
- STATIC_CAST(TM2GSvgElementHandle, aChildElementHandle)); );
- }
- M2G_DO_UNLOCK(aJni)
-
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _appendChild - end");
- M2GGeneral::CheckErrorCode(aJni, err);
-}
-
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GSVGElement::_checkRemoveable
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::CheckRemoveableL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aElementHandle Element handle
- * @param aRemoveable Result
- */
-JNIEXPORT jint JNICALL Java_com_nokia_microedition_m2g_M2GSVGElement__1checkRemoveable(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aElementHandle)
-{
- TInt removeable = -1;
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _checkRemoveable - begin");
- TInt err = KM2GNotOk;
-
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
-
- TRAP(err, aProxy->CheckRemoveableL(aElementHandle, removeable););
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
- M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _checkRemoveable: %d - end", removeable);
- return removeable;
-}
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GSVGElement::_getBBox
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::GetBBoxL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aElementHandle Element handle
- * @param aAttributeTypeId Attribute type id
- * @param aRectData Returns rect components
- * @param aResult Result "0" ok
- */
-JNIEXPORT jint JNICALL
-Java_com_nokia_microedition_m2g_M2GSVGElement__1getBBox(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aElementHandle,
- jshort aAttributeTypeId,
- jfloatArray aRectComponents)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getBBox - begin");
-
- TM2GRectData rect;
- TInt result = 0;
- TInt err = KM2GNotOk;
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
-
- TRAP(err, aProxy->GetBBoxL(
- STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
- STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
- rect, result); );
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
-
- aJni->SetFloatArrayRegion(
- REINTERPRET_CAST(jfloatArray, aRectComponents),
- 0,
- rect.Count(), REINTERPRET_CAST(jfloat*, rect.Begin()));
-
- M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getBBox: %d - end", result);
- return result;
-}
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GSVGElement::_getColorTrait
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::GetColorTraitL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aElementHandle Element handle
- * @param aAttributeTypeId Attribute type id
- * @param aColors Color elements ( RGB )
- * @param aTrait Result
- */
-JNIEXPORT jint JNICALL
-Java_com_nokia_microedition_m2g_M2GSVGElement__1getColorTrait(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aElementHandle,
- jshort aAttributeTypeId,
- jintArray aColorComponents)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getColorTrait - begin");
- TM2GColorData color;
- TInt result = -1;
- TInt err = KM2GNotOk;
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
- TRAP(err, aProxy->GetColorTraitL(
- aElementHandle,
- aAttributeTypeId,
- color,
- result); );
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
- if (color[ 0 ] == -1 && color[ 1 ] == -1 && color[ 2 ] == -1)
- {
- result = 0;
- aJni->SetIntArrayRegion(aColorComponents, 0, color.Count(), &(color[ 0 ]));
- }
- else if (result != -1)
- {
- result = 1;
- aJni->SetIntArrayRegion(aColorComponents, 0, color.Count(), color.Begin());
- }
-
- M2G_DEBUG_4("M2G_DEBUG: JNI ( M2GSVGElement ) _getColorTrait: %d, R=%d, G=%d, B=%d - end", result, color[ 0 ], color[ 1 ], color[ 2 ]);
- return result;
-}
-
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GSVGElement::_getElementTypeId
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::GetElementTypeIdL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aElementHandle Element handle
- * @param aId
- */
-JNIEXPORT jshort JNICALL
-Java_com_nokia_microedition_m2g_M2GSVGElement__1getElementTypeId(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aElementHandle)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getElementTypeId - begin");
- TInt16 id = 0;
- TInt err = KM2GNotOk;
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
- TRAP(err, aProxy->GetElementTypeIdL(aElementHandle, id); );
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
- M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getElementTypeId: %d - end", id);
- return id;
-}
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GSVGElement::_getEnumTrait
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::GetEnumTraitL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aElementHandle Element handle
- * @param aAttributeTypeId Attribute type id
- * @param aEnumTrait The enumeration value of the specified attribute
- */
-JNIEXPORT jshort JNICALL
-Java_com_nokia_microedition_m2g_M2GSVGElement__1getEnumTrait(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aElementHandle,
- jshort aAttributeTypeId)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getEnumTrait - begin");
- TInt16 enumTrait = 0;
- TInt err = KM2GNotOk;
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
-
- TRAP(err, aProxy->GetEnumTraitL(
- STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
- STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
- enumTrait); );
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
- M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getEnumTrait: %d - end", enumTrait);
- return enumTrait;
-}
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GSVGElement::_getFirstElementChild
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::GetFirstElementChildL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aElementHandle Element handle
- * @param aHandle Element handle to be returned.
- */
-JNIEXPORT jint JNICALL
-Java_com_nokia_microedition_m2g_M2GSVGElement__1getFirstElementChild(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aElementHandle)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getFirstElementChild - begin");
-
- TInt childHandle = M2G_INVALID_HANDLE;
- TInt err = KM2GNotOk;
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
- TRAP(err, aProxy->GetFirstElementChildL(aElementHandle, childHandle); );
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
- M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getFirstElementChild: %d - end", childHandle);
- return childHandle;
-}
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GSVGElement::_getFloatTrait
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::GetFloatTraitL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aElementHandle Element handle
- * @param aAttributeTypeId Attribute type id
- * @param aFloatTrait Float attribute to be returned
- */
-JNIEXPORT jfloat JNICALL
-Java_com_nokia_microedition_m2g_M2GSVGElement__1getFloatTrait(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aElementHandle,
- jshort aAttributeTypeId)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getFloatTrait - begin");
- TInt err = KM2GNotOk;
- TReal32 floatTrait = 0;
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
-
- TRAP(err ,aProxy->GetFloatTraitL(
- STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
- STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
- floatTrait););
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
- M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getFloatTrait: %f - end", floatTrait);
- return STATIC_CAST(jfloat, floatTrait);
-}
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GSVGElement::_getMatrixTrait
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::GetMatrixTraitL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aElementHandle Element handle
- * @param aAttributeTypeId Attribute type id
- * @param aResult Result: "0" if ok and "-1" if nok
- s*/
-JNIEXPORT jint JNICALL
-Java_com_nokia_microedition_m2g_M2GSVGElement__1getMatrixTrait(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aElementHandle,
- jshort aAttributeTypeId,
- jfloatArray aMatrixComponents)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getMatrixTrait - begin");
- TM2GMatrixData matrix;
- TInt result = -1;
- TInt err = KM2GNotOk;
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
-
- TRAP(err, aProxy->GetMatrixTraitL(
- STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
- STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
- matrix, result); );
- }
- M2G_DO_UNLOCK(aJni)
-
- if (M2GGeneral::CheckErrorCode(aJni, err) == KM2GOk)
- {
- // Init matrix object
- jfloat* components = aJni->GetFloatArrayElements(aMatrixComponents, 0);
- TInt count =
- M2GGeneral::Min(aJni->GetArrayLength(aMatrixComponents), matrix.Count());
- for (TInt index = 0; index < count; index++)
- {
- components[ index ] = matrix[ index ];
- }
- // Release data source
- aJni->ReleaseFloatArrayElements(aMatrixComponents, components, 0);
- }
-
- M2G_DEBUG_6("M2G_DEBUG: JNI ( M2GSVGElement ) _getMatrixTrait: %f, %f, %f, %f, %f, %f - end", matrix[ 0 ], matrix[ 1 ], matrix[ 2 ], matrix[ 3 ], matrix[ 4 ], matrix[ 5 ]);
- return result;
-}
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GSVGElement::_getNextElementSibling
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::GetNextElementSiblingL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aElementHandle Element pointer.
- * @param aSiblingHandle Sibling handle
- */
-JNIEXPORT jint JNICALL
-Java_com_nokia_microedition_m2g_M2GSVGElement__1getNextElementSibling(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aElementHandle)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getNextElementSibling - begin");
- TInt siblingHandle = M2G_INVALID_HANDLE;
- TInt err = KM2GNotOk;
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
- TRAP(err, aProxy->GetNextElementSiblingL(aElementHandle, siblingHandle); );
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
- M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getNextElementSibling: %d - end", siblingHandle);
- return siblingHandle;
-}
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GSVGElement::_getParent
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::GetParentL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aElementHandle Element pointer.
- * @param aParentHandle Parent handle to be returned.
- */
-JNIEXPORT jint JNICALL
-Java_com_nokia_microedition_m2g_M2GSVGElement__1getParent(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aElementHandle)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getParent - begin");
- TInt parentHandle = M2G_INVALID_HANDLE;
- TInt err = KM2GNotOk;
-
- M2G_DO_LOCK
-
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
- TRAP(err, aProxy->GetParentL(aElementHandle, parentHandle););
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
- M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getParent: %d - end", parentHandle);
- return parentHandle;
-}
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GSVGElement::_getPathTrait
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::GetPathTraitL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aElementHandle Element pointer.
- * @param aAttributeTypeId Attribute type.
- */
-JNIEXPORT jint JNICALL
-Java_com_nokia_microedition_m2g_M2GSVGElement__1getPathTrait(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aElementHandle,
- jshort aAttributeTypeId)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getPathTrait - begin");
- TInt aPathTrait = 0;
- TInt err = KM2GNotOk;
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
-
- TRAP(err, aProxy->GetPathTraitL(
- STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
- STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
- aPathTrait); );
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
- M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getPathTrait: %d - end", aPathTrait);
- return aPathTrait;
-}
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GSVGElement::_getRectTrait
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::GetRectTraitL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aElementHandle Element handle
- * @param aAttributeTypeId Attribute type id
- * @param aRectData Returns rect components
- * @param aResult Result "0" if ok and "-1" if nok
- */
-JNIEXPORT jint JNICALL
-Java_com_nokia_microedition_m2g_M2GSVGElement__1getRectTrait(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aElementHandle,
- jshort aAttributeTypeId,
- jfloatArray aRectComponents)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getRectTrait - begin");
- TM2GRectData rect;
- TInt result = 0;
- TInt err = KM2GNotOk;
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
-
- TRAP(err , aProxy->GetRectTraitL(
- STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
- STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
- rect, result); );
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
- aJni->SetFloatArrayRegion(
- REINTERPRET_CAST(jfloatArray, aRectComponents),
- 0,
- rect.Count(), REINTERPRET_CAST(jfloat*, rect.Begin()));
-
- M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getRectTrait: %d - end", result);
- return result;
-}
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GSVGElement::_getRootElement
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::GetRootElementL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aDocumentHandle Document pointer.
- * @param aRootElementHandle Root element handle
- */
-JNIEXPORT jint JNICALL
-Java_com_nokia_microedition_m2g_M2GSVGElement__1getRootElement(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aDocumentHandle)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getRootElement - begin");
- TInt rootElementHandle = M2G_INVALID_HANDLE;
- TInt err = KM2GNotOk;
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
-
- TRAP(err, aProxy->GetRootElementL(
- STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle),
- rootElementHandle); );
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
-
- M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getRootElement: %d - end", rootElementHandle);
- return rootElementHandle;
-}
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GSVGElement::_getScreenBBox
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::GetScreenBBoxL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aElementHandle Element handle
- * @param aRectData Returns rect components
- */
-JNIEXPORT void JNICALL
-Java_com_nokia_microedition_m2g_M2GSVGElement__1getScreenBBox(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aElementHandle,
- jfloatArray aScreenBBoxComponents)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getScreenBBox - begin");
- TM2GScreenBBoxData screenBBox;
- TInt err = KM2GNotOk;
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
-
- TRAP(err, aProxy->GetScreenBBoxL(
- STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
- screenBBox); );
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
-
- aJni->SetFloatArrayRegion(
- REINTERPRET_CAST(jfloatArray, aScreenBBoxComponents),
- 0,
- screenBBox.Count(), REINTERPRET_CAST(jfloat*, screenBBox.Begin()));
-
- M2G_DEBUG_4("M2G_DEBUG: JNI ( M2GSVGElement ) _getScreenBBox: %f, %f, %f, %f - end", screenBBox[ 0 ], screenBBox[ 1 ], screenBBox[ 2 ], screenBBox[ 3 ]);
-}
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GSVGElement::_getStringTrait
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::GetStringTraitL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aElementHandle Element pointer.
- * @param aAttributeTypeId Attribute type.
- * @param aAttribute Returns a string attribute
- */
-JNIEXPORT jstring JNICALL
-Java_com_nokia_microedition_m2g_M2GSVGElement__1getStringTrait(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aElementHandle,
- jshort aAttributeTypeId)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getStringTrait - begin");
-
- TPtrC16 attribute;
- TInt err = KM2GNotOk;
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
-
- TRAP(err, aProxy->GetStringTraitL(
- STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
- STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
- attribute); );
- }
- M2G_DO_UNLOCK(aJni)
-
- if ((M2GGeneral::CheckErrorCode(aJni, err) == KM2GOk) &&
- (attribute.Length() > 0))
- {
- return CreateJavaString(*aJni, attribute);
- }
-
- return NULL;
- M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getStringTrait: %d - end", err);
-}
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GSVGElement::_getUsedFromElement
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::GetUsedFromElementL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aElementHandle Element pointer.
- * @param aHandle Return element handle
- */
-JNIEXPORT jint JNICALL
-Java_com_nokia_microedition_m2g_M2GSVGElement__1getUsedFromElement(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aElementHandle)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getUsedFromElement - begin");
- TInt handle = M2G_INVALID_HANDLE;
- TInt err = KM2GNotOk;
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
-
- TRAP(err, aProxy->GetUsedFromElementL(
- STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
- handle); );
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
- M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getUsedFromElement: %d - end", handle);
- return handle;
-}
-
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GSVGElement::_insertBefore
-// -----------------------------------------------------------------------------
-/**
- * Class: com_nokia_microedition_m2g_M2GSVGElement
- * Method: insertBefore
- * Signature:
- */
-JNIEXPORT void JNICALL
-Java_com_nokia_microedition_m2g_M2GSVGElement__1insertBefore(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aElementHandle,
- jint aNewChildElementHandle,
- jint aReferenceElementHandle)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _insertBefore - begin");
- TInt err = KM2GNotOk;
-
- M2G_DO_LOCK
-
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
-
- TRAP(err, aProxy->InsertBeforeL(
- STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
- STATIC_CAST(TM2GSvgElementHandle, aNewChildElementHandle),
- STATIC_CAST(TM2GSvgElementHandle, aReferenceElementHandle)); );
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _insertBefore - end");
-}
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GSVGElement::_isUsed
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::IsUsedL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aElementHandle Element pointer.
- * @param aResult Return "1" if used otherwise returns "0"
- */
-JNIEXPORT jint JNICALL
-Java_com_nokia_microedition_m2g_M2GSVGElement__1isUsed(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aElementHandle )
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _isUsed - begin");
- TInt result = KM2GNotOk;
- TInt err = KM2GNotOk;
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
- TRAP(err, aProxy->IsUsedL(STATIC_CAST(TM2GSvgElementHandle, aElementHandle), result); );
- }
- M2G_DO_UNLOCK(aJni)
-
-
- M2GGeneral::CheckErrorCode(aJni, err);
- M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _isUsed: %d - end", result);
- return result;
-}
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GSVGElement::_removeChild
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::RemoveChild method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aElementHandle Element pointer.
- * @param aChildElementHandle child element pointer
- * @param aHandle Handle to removed element.
- */
-JNIEXPORT jint JNICALL
-Java_com_nokia_microedition_m2g_M2GSVGElement__1removeChild(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aElementHandle,
- jint aChildElementHandle)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _removeChild - begin");
- TInt handle = M2G_INVALID_HANDLE;
- TInt err = KM2GNotOk;
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
-
- TRAP(err ,aProxy->RemoveChildL(
- STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
- STATIC_CAST(TM2GSvgElementHandle, aChildElementHandle), handle); );
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
-
- M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _removeChild: %d - end", handle);
- return handle;
-}
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GSVGElement::_setColorTrait
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::SetColorTraitL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aElementHandle Element pointer.
- * @param aAttributeTypeId -
- * @param aColorData -
- */
-JNIEXPORT void JNICALL
-Java_com_nokia_microedition_m2g_M2GSVGElement__1setColorTrait(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aElementHandle,
- jshort aAttributeTypeId,
- jint aRed, jint aGreen, jint aBlue)
-{
- M2G_DEBUG_3("M2G_DEBUG: JNI ( M2GSVGElement ) _setColorTrait: R=%d, G=%d, B=%d - begin", aRed, aGreen, aBlue);
- TM2GColorData color;
- color[ 0 ] = aRed;
- color[ 1 ] = aGreen;
- color[ 2 ] = aBlue;
- TInt err = KM2GNotOk;
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
-
- TRAP(err, aProxy->SetColorTraitL(
- STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
- STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
- color); );
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
- M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _setColorTrait: %d - end", err);
-}
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GSVGElement::_setEnumTrait
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::SetEnumTraitL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aElementHandle Element pointer.
- * @param aAttributeTypeId -
- * @param aValue
- */
-JNIEXPORT void JNICALL
-Java_com_nokia_microedition_m2g_M2GSVGElement__1setEnumTrait(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aElementHandle,
- jshort aAttributeTypeId,
- jshort aValue)
-{
- M2G_DEBUG_2("M2G_DEBUG: JNI ( M2GSVGElement ) _setEnumTrait: type=%d, value=%d - begin", aAttributeTypeId, aValue);
- TInt err = KM2GNotOk;
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
-
- TRAP(err, aProxy->SetEnumTraitL(
- STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
- STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
- aValue); );
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _setEnumTrait - end");
-}
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GSVGElement::_setFloatTrait
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::SetFloatTraitL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aElementHandle Element pointer.
- * @param aAttributeTypeId -
- * @param aValue -
- */
-JNIEXPORT void JNICALL
-Java_com_nokia_microedition_m2g_M2GSVGElement__1setFloatTrait(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aElementHandle,
- jshort aAttributeTypeId,
- jfloat aValue)
-{
- M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _setFloatTrait: %f - begin", aValue);
- TInt err = KM2GNotOk;
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
-
- TRAP(err, aProxy->SetFloatTraitL(
- STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
- STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
- aValue); );
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _setFloatTrait: - end");
-}
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GSVGElement::_setMatrixTrait
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::SetMatrixTraitL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aElementHandle Element handle
- * @param aAttributeTypeId Attribute type id
- * @param aMatrixData -
- */
-JNIEXPORT void JNICALL
-Java_com_nokia_microedition_m2g_M2GSVGElement__1setMatrixTrait(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aElementHandle,
- jshort aAttributeTypeId,
- jfloatArray aMatrixComponents)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _setMatrixTrait - begin");
- TInt err = KM2GNotOk;
- TM2GMatrixData matrix;
- // Init matrix object
- jfloat* components = aJni->GetFloatArrayElements(aMatrixComponents,0);
- TInt count = aJni->GetArrayLength(aMatrixComponents);
- for (TInt index = 0; index < count; index++)
- {
- matrix[ index ] = components[ index ];
- }
- // Release data source
- aJni->ReleaseFloatArrayElements(aMatrixComponents, components, JNI_ABORT);
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
-
- TRAP(err, aProxy->SetMatrixTraitL(
- STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
- STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
- matrix); );
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
- M2G_DEBUG_6("JNI ( M2GSVGElement ) _setMatrixTrait: %f, %f, %f, %f, %f, %f - end", matrix[ 0 ], matrix[ 1 ], matrix[ 2 ], matrix[ 3 ], matrix[ 4 ], matrix[ 5 ]);
-}
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GSVGElement::_setPathTrait
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::SetPathTraitL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aElementHandle Element handle
- * @param aAttributeTypeId Attribute type id
- * @param aMatrixData -
- */
-JNIEXPORT void JNICALL
-Java_com_nokia_microedition_m2g_M2GSVGElement__1setPathTrait(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aElementHandle,
- jshort aAttributeTypeId,
- jint aPathHandle)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _setPathTrait - begin");
- TInt err = KM2GNotOk;
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
-
- TRAP(err,aProxy->SetPathTraitL(
- STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
- STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
- STATIC_CAST(TM2GSvgPathHandle, aPathHandle)); );
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _setPathTrait - end");
-}
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GSVGElement::_setRectTrait
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::SetRectTraitL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aElementHandle Element handle
- * @param aAttributeTypeId Attribute type id
- * @param aMatrixData -
- */
-JNIEXPORT void JNICALL
-Java_com_nokia_microedition_m2g_M2GSVGElement__1setRectTrait(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aElementHandle,
- jshort aAttributeTypeId,
- jfloat aX, jfloat aY, jfloat aWidth, jfloat aHeight)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _setRectTrait - begin");
- TM2GRectData rect;
- rect[ 0 ] = aX;
- rect[ 1 ] = aY;
- rect[ 2 ] = aWidth;
- rect[ 3 ] = aHeight;
- TInt err = KM2GNotOk;
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
-
- TRAP(err, aProxy->SetRectTraitL(
- STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
- STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
- rect); );
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getRectTrait - end");
-}
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GSVGElement::_setStringTrait
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::SetStringTraitL method.
- * @since Series S60 3.0
- * @param aElementHandle Element handle
- * @param aAttributeTypeId Attribute type id
- * @param aString -
- */
-JNIEXPORT void JNICALL
-Java_com_nokia_microedition_m2g_M2GSVGElement__1setStringTrait(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aElementHandle,
- jshort aAttributeTypeId,
- jstring aValue)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _setStringTrait - begin");
- RJString str(*aJni, aValue);
- TInt err = KM2GNotOk;
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
- TPtrC16 lValue=STATIC_CAST(TPtrC16, str);
-
- TRAP(err, aProxy->SetStringTraitL(
- STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
- STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
- lValue); );
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _setStringTrait - end");
-}
-
-M2G_NS_END
--- a/javauis/m2g_qt/src/jni/M2GSVGImage.cpp Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,270 +0,0 @@
-/*
-* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: JNI methods
-*
-*/
-
-// INCLUDE FILES
-#include "CM2GEventSource.h"
-#include "com_nokia_microedition_m2g_M2GSVGImage.h"
-#include "MM2GSVGProxy.h"
-
-M2G_NS_START
-
-// EXTERNAL DATA STRUCTURES
-
-// EXTERNAL FUNCTION PROTOTYPES
-
-// CONSTANTS
-
-// MACROS
-
-// LOCAL CONSTANTS AND MACROS
-
-// MODULE DATA STRUCTURES
-
-// LOCAL FUNCTION PROTOTYPES
-
-// FORWARD DECLARATIONS
-
-// CLASS DECLARATION
-
-// ================================ FUNCTIONS ==================================
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GSVGImage::_dispatchMouseEvent
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::DispatchMouseEventL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aDocumentHandle Document handle.
- * @param aX X coordinate.
- * @param aY Y coordinate
- * @param aElementHandle Target element handle
- */
-JNIEXPORT jint JNICALL
-Java_com_nokia_microedition_m2g_M2GSVGImage__1dispatchMouseEvent(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aDocumentHandle, jint aX, jint aY)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGImage ) _dispatchMouseEvent - begin");
-
- TInt elementHandle = M2G_INVALID_HANDLE;
- TInt err = KM2GNotOk;
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy * aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
- TRAP(err, aProxy->DispatchMouseEventL(
- STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle),
- aX, aY, elementHandle); );
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
-
- M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGImage ) _dispatchMouseEvent: %d - end", elementHandle);
- return elementHandle;
-}
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GSVGImage::_focusOn
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::FocusOnL method.
- * @since Series S60 3.1
- * @param aProxy Proxy instance.
- * @param aDocumentHandle Document handle.
- * @param aElementHandle Target element handle
- * JNI method
- */
-JNIEXPORT void JNICALL
-Java_com_nokia_microedition_m2g_M2GSVGImage__1focusOn(
- JNIEnv* /* aJni */,
- jclass,
- jint aSvgProxyHandle,
- jint aDocumentHandle, jint aElementHandle)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGImage ) _focusOn - begin");
-
- // TInt elementHandle = M2G_INVALID_HANDLE;
- TInt err = KM2GNotOk;
-
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy * aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
- TRAP(err, aProxy->FocusOnL(
- STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle),
- STATIC_CAST(TM2GSvgElementHandle, aElementHandle)); );
- }
-
- M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGImage ) _focusOn: %d - end", err);
-}
-
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GSVGImage::_focusOut
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::FocusOutL method.
- * @since Series S60 3.1
- * @param aProxy Proxy instance.
- * @param aDocumentHandle Document handle.
- * @param aElementHandle Target element handle
- * JNI method
- */
-JNIEXPORT void JNICALL
-Java_com_nokia_microedition_m2g_M2GSVGImage__1focusOut(
- JNIEnv* /* aJni */,
- jclass,
- jint aSvgProxyHandle,
- jint aDocumentHandle, jint aElementHandle)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGImage ) _focusOut - begin");
- TInt err = KM2GNotOk;
-
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy * aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
- TRAP(err,aProxy->FocusOutL(
- STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle),
- STATIC_CAST(TM2GSvgElementHandle, aElementHandle)); );
- }
-
- M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGImage ) _focusOut: %d - end", err);
-
-}
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GSVGImage::_getExternalListItem
-// EXTENSION
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::GetExternalListItemL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aDocumentHandle Document pointer.
- * @param aIndex External item index.
- * @param aItem External item
- * @throws Exception if not ok
- * JNI method
- */
-JNIEXPORT jstring JNICALL
-Java_com_nokia_microedition_m2g_M2GSVGImage__1getExternalListItem(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aDocumentHandle,
- jint aIndex)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGImage ) _getExternalListItem - begin");
- TPtrC16 lItem;
- TInt err = KM2GNotOk;
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy * aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
- TRAP(err, aProxy->GetExternalListItemL(
- STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle),
- aIndex,
- lItem); );
- }
- M2G_DO_UNLOCK(aJni)
-
- if ((M2GGeneral::CheckErrorCode(aJni, err) == KM2GOk) && (lItem.Length() > 0))
- {
- return CreateJavaString(*aJni, lItem);
- }
-
- return NULL;
-}
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GSVGImage::_getExternalListSize
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::GetExternalListItemL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aDocumentHandle Document handle.
- * @param aListSz List size to be returned.
- */
-JNIEXPORT TInt JNICALL
-Java_com_nokia_microedition_m2g_M2GSVGImage__1getExternalListSize(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aDocumentHandle)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGImage ) _getExternalListSize - begin");
-
- // TInt elementHandle = M2G_INVALID_HANDLE;
- TInt err = KM2GNotOk;
- TInt listSz = 0;
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy * aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
- TRAP(err, aProxy->GetExternalListSizeL(
- STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle), listSz); );
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
-
- M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGImage ) _getExternalListSize: %d - end", listSz);
- return listSz;
-}
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GSVGImage::_getExternalListItem
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::GetExternalListItemL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aDocumentHandle Document pointer.
- * @param aIndex Index.
- * @param aStrBuf Returns a string
- * @throws Exception if not ok
- * JNI method
- */
-JNIEXPORT void JNICALL
-Java_com_nokia_microedition_m2g_M2GSVGImage__1initViewport(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aDocumentHandle)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGImage ) _initViewport - begin");
- // TInt elementHandle = M2G_INVALID_HANDLE;
- TInt err = KM2GNotOk;
-
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy * aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
- TRAP(err, aProxy->InitViewportL(
- STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle)); );
- }
- M2GGeneral::CheckErrorCode(aJni, err);
-
- M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGImage ) _initViewport: %d - end", err);
-
-}
-
-M2G_NS_END
--- a/javauis/m2g_qt/src/jni/M2GSVGPath.cpp Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,405 +0,0 @@
-/*
-* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: JNI methods
-*
-*/
-
-// INCLUDE FILES
-#include "CM2GEventSource.h"
-#include "com_nokia_microedition_m2g_M2GSVGPath.h"
-#include "MM2GSVGProxy.h"
-
-M2G_NS_START
-
-// EXTERNAL DATA STRUCTURES
-
-// EXTERNAL FUNCTION PROTOTYPES
-
-// CONSTANTS
-
-// MACROS
-
-// LOCAL CONSTANTS AND MACROS
-
-// MODULE DATA STRUCTURES
-
-// LOCAL FUNCTION PROTOTYPES
-
-// FORWARD DECLARATIONS
-
-// CLASS DECLARATION
-
-// ================================ FUNCTIONS ==================================
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GSVGPath::_addClose
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::AddCloseL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aPathHandle Svg path handle
- */
-JNIEXPORT void JNICALL
-Java_com_nokia_microedition_m2g_M2GSVGPath__1addClose(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aPathHandle)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGPath ) _addClose - begin");
- TInt err = KM2GNotOk;
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy* aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle);
- TRAP(err, aProxy->AddCloseL(STATIC_CAST(TM2GSvgPathHandle, aPathHandle)); );
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
-
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGPath ) _addClose - end");
-}
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GSVGPath::_addCurve
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::AddCurveTo method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aPathHandle Svg path handle
- * @param aPathCurveData Curve parameters
- */
-JNIEXPORT void JNICALL
-Java_com_nokia_microedition_m2g_M2GSVGPath__1addCurveTo(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aPathHandle,
- jfloat aX1, jfloat aY1, jfloat aX2, jfloat aY2, jfloat aX3, jfloat aY3 )
-{
- M2G_DEBUG_6("M2G_DEBUG: JNI ( M2GSVGPath ) _addCurveTo: X1=%f, Y1=%f, X2=%f, Y2=%f, X3=%f, Y3=%f - begin", aX1, aY1, aX2, aY2, aX3, aY3);
- TInt err = KM2GNotOk;
-
- TM2GPathCurveData curve;
- curve[ 0 ] = STATIC_CAST(TReal32, aX1);
- curve[ 1 ] = STATIC_CAST(TReal32, aY1);
- curve[ 2 ] = STATIC_CAST(TReal32, aX2);
- curve[ 3 ] = STATIC_CAST(TReal32, aY2);
- curve[ 4 ] = STATIC_CAST(TReal32, aX3);
- curve[ 5 ] = STATIC_CAST(TReal32, aY3);
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy* aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle);
- TRAP(err, aProxy->AddCurveToL(
- STATIC_CAST(TM2GSvgPathHandle, aPathHandle),
- curve); );
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGPath ) _addCurveTo - end");
-}
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GSVGPath::_addLineTo
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::AddLineToL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aPathHandle Svg path handle
- * @param aX -
- * @param aY -
- */
-JNIEXPORT void JNICALL
-Java_com_nokia_microedition_m2g_M2GSVGPath__1addLineTo(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aPathHandle,
- jfloat aX, jfloat aY )
-{
- M2G_DEBUG_2("M2G_DEBUG: JNI ( M2GSVGPath ) _addLineTo: X=%f, Y=%f - begin", aX, aY);
- TInt err = KM2GNotOk;
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy* aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle);
- TRAP(err, aProxy->AddLineToL(STATIC_CAST(TM2GSvgPathHandle, aPathHandle), *(REINTERPRET_CAST(TReal32*, &aX)), *(REINTERPRET_CAST(TReal32*, &aY))); );
-
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
-
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGPath ) _addLineTo - end");
-}
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GSVGPath::_addMoveTo
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::AddMoveToL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aPathHandle Svg path handle
- * @param aX -
- * @param aY -
- */
-JNIEXPORT void JNICALL
-Java_com_nokia_microedition_m2g_M2GSVGPath__1addMoveTo(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aPathHandle,
- jfloat aX,
- jfloat aY)
-{
- M2G_DEBUG_2("M2G_DEBUG: JNI ( M2GSVGPath ) _addMoveTo: X=%f, Y=%f - begin", aX, aY);
- TInt err = KM2GNotOk;
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy * aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle);
- TRAP(err, aProxy->AddMoveToL(STATIC_CAST(TM2GSvgPathHandle, aPathHandle), aX, aY) );
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGPath ) _addMoveTo - end");
-}
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GSVGPath::_addQuadTo
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::AddQuadToL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aPathHandle Svg path handle
- * @param aX1 -
- * @param aY1 -
- * @param aX2 -
- * @param aY2 -
- */
-JNIEXPORT void JNICALL
-Java_com_nokia_microedition_m2g_M2GSVGPath__1addQuadTo(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aPathHandle,
- jfloat aX1, jfloat aY1, jfloat aX2, jfloat aY2)
-{
- M2G_DEBUG_4("M2G_DEBUG: JNI ( M2GSVGPath ) _addQuadTo: X1=%f, Y1=%f, X2=%f, Y2=%f - begin", aX1, aY1, aX2, aY2);
- // TInt elementHandle = M2G_INVALID_HANDLE;
- TInt err = KM2GNotOk;
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy * aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle);
- TRAP(err, aProxy->AddQuadToL(
- STATIC_CAST(TM2GSvgPathHandle, aPathHandle),aX1, aY1, aX2, aY2); );
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGPath ) _addQuadTo - end");
-}
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GSVGPath::_createPath
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::CreatePathL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aPathHandle Path handle
- */
-JNIEXPORT jint JNICALL
-Java_com_nokia_microedition_m2g_M2GSVGPath__1createPath(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGPath ) _createPath - begin");
-
- TInt err = KM2GNotOk;
- TInt pathHandle = M2G_INVALID_HANDLE;
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy * aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle);
- TRAP(err, aProxy->CreatePathL(pathHandle); );
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
-
- M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGPath ) _createPath: %d - end", pathHandle);
- return STATIC_CAST(jint, pathHandle);
-}
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GSVGPath::_destroyPath
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::DestroyPathL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aPathHandle Svg path handle
- */
-JNIEXPORT void JNICALL
-Java_com_nokia_microedition_m2g_M2GSVGPath__1destroyPath(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aPathHandle)
-{
- M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGPath ) _destroyPath: %d - begin", aPathHandle);
- TInt err = KM2GNotOk;
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy * aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle);
- TRAP(err, aProxy->DestroyPathL(
- STATIC_CAST(TM2GSvgPathHandle, STATIC_CAST(TM2GSvgPathHandle, aPathHandle))); );
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGPath ) _destroyPath - end");
-}
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GSVGPath::_getNumberOfSegments
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::GetNumberOfSegments method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aPathHandle Svg path handle
- * @return Number of segments
- */
-JNIEXPORT jint JNICALL
-Java_com_nokia_microedition_m2g_M2GSVGPath__1getNumberOfSegments(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aPathHandle)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGPath ) _getNumberOfSegments - begin");
- TInt err = KM2GNotOk;
- TInt numberOfSegments = 0;
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy * aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle);
- TRAP(err, aProxy->GetNumberOfSegmentsL(
- STATIC_CAST(TM2GSvgPathHandle, aPathHandle),
- numberOfSegments); );
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
- M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGPath ) _getNumberOfSegments: %d - end", numberOfSegments);
- return STATIC_CAST(jint, numberOfSegments);
-}
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GSVGPath::_getSegmentParameter
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::GetSegmentParameterL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aPathHandle Svg path handle
- * @param aSegmentIndex -
- * @param aParamIndex -
- * @param aSegmentParam Segment parameter
- */
-JNIEXPORT jfloat JNICALL
-Java_com_nokia_microedition_m2g_M2GSVGPath__1getSegmentParameter(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aPathHandle, jint aSegmentIndex, jint aParamIndex)
-{
- M2G_DEBUG_2("M2G_DEBUG: JNI ( M2GSVGPath ) _getSegmentParameter: seg index=%d, param index=%d - begin", aSegmentIndex, aParamIndex);
- TInt err = KM2GNotOk;
- TReal32 segmentParam = 0;
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy * aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle);
- TRAP(err, aProxy->GetSegmentParameterL(
- STATIC_CAST(TM2GSvgPathHandle, aPathHandle), aSegmentIndex,aParamIndex, segmentParam); );
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
-
- M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGPath ) _getSegmentParameter: %f - end", segmentParam);
- return STATIC_CAST(jfloat, segmentParam);
-}
-
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GSVGPath::_getSegmentType
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::GetSegmentTypeL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aPathHandle Svg path handle
- * @param aSegmentIndex -
- * @param aSegmentType Segment type to be returned
- */
-JNIEXPORT jshort JNICALL
-Java_com_nokia_microedition_m2g_M2GSVGPath__1getSegmentType(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- TInt aPathHandle,
- jint aIndex)
-{
- M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGPath ) _getSegmentType: index=%d - begin", aIndex);
- TInt err = KM2GNotOk;
- TInt16 aSegmentType = 0;
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy * aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle);
- TRAP(err, aProxy->GetSegmentTypeL(
- STATIC_CAST(TM2GSvgPathHandle, aPathHandle), aIndex,aSegmentType); );
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
- M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGPath ) _getSegmentType: %d - end", aSegmentType);
- return STATIC_CAST(jshort, aSegmentType);
-}
-
-M2G_NS_END
--- a/javauis/m2g_qt/src/jni/M2GSVGSVGElement.cpp Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,118 +0,0 @@
-/*
-* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: JNI methods
-*
-*/
-
-// INCLUDE FILES
-#include "CM2GEventSource.h"
-#include "com_nokia_microedition_m2g_M2GSVGSVGElement.h"
-#include "MM2GSVGProxy.h"
-
-M2G_NS_START
-
-// EXTERNAL DATA STRUCTURES
-
-// EXTERNAL FUNCTION PROTOTYPES
-
-// CONSTANTS
-
-// MACROS
-
-// LOCAL CONSTANTS AND MACROS
-
-// MODULE DATA STRUCTURES
-
-// LOCAL FUNCTION PROTOTYPES
-
-// FORWARD DECLARATIONS
-
-// CLASS DECLARATION
-
-// ================================ FUNCTIONS ==================================
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GSVGImage::_getMediaTime
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::GetMediaTimeL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aDocumentHandle Document handle
- * @param aSeconds Media time to be returned.
- */
-JNIEXPORT jfloat JNICALL
-Java_com_nokia_microedition_m2g_M2GSVGSVGElement__1getMediaTime(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aDocumentHandle)
-{
- M2G_DEBUG_0("JNI ( M2GSVGSVGElement ) _getMediaTime - begin");
- TReal32 seconds = 0;
- TInt err = KM2GNotOk;
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
- TRAP(err, aProxy->GetMediaTimeL(STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle),seconds); );
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
-
- M2G_DEBUG_1("JNI ( M2GSVGSVGElement ) _getMediaTime: %f - end", seconds);
- return STATIC_CAST(jfloat, seconds);
-}
-
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GSVGImage::_setMediaTime
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GSVGProxy::SetMediaTimeL method.
- * @since Series S60 3.0
- * @param aProxy Proxy instance.
- * @param aDocumentHandle Document handle
- * @param aSeconds Media time
- */
-JNIEXPORT void JNICALL
-Java_com_nokia_microedition_m2g_M2GSVGSVGElement__1setMediaTime(
- JNIEnv* aJni,
- jclass,
- jint aSvgProxyHandle,
- jint aDocumentHandle,
- jfloat aSeconds
-)
-{
- M2G_DEBUG_0("JNI ( M2GSVGSVGElement ) _setMediaTime - begin");
- TInt err = KM2GNotOk;
-
- TReal32* lseconds = REINTERPRET_CAST(TReal32*, &aSeconds);
-
- M2G_DO_LOCK
- if (aSvgProxyHandle)
- {
- MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
- TRAP(err, aProxy->SetMediaTimeL(
- STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle),
- *lseconds); );
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
-
- M2G_DEBUG_1("JNI ( M2GSVGSVGElement ) _setMediaTime: %f - end", aSeconds);
-}
--- a/javauis/m2g_qt/src/jni/M2GScalableGraphics.cpp Fri Jul 23 12:27:20 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,373 +0,0 @@
-/*
-* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: JNI methods
-*
-*/
-
-// INCLUDE FILES
-#include "CM2GEventSource.h"
-#include "com_nokia_microedition_m2g_M2GScalableGraphics.h"
-#include "CM2GRenderContext.h"
-#include "MM2GSVGProxy.h" // TM2GRenderRect
-#include <graphics.h>
-
-M2G_NS_START
-
-#include "M2GUtils.h"
-// EXTERNAL DATA STRUCTURES
-
-// EXTERNAL FUNCTION PROTOTYPES
-
-// CONSTANTS
-
-// MACROS
-
-// LOCAL CONSTANTS AND MACROS
-
-// MODULE DATA STRUCTURES
-
-// LOCAL FUNCTION PROTOTYPES
-
-// FORWARD DECLARATIONS
-
-// CLASS DECLARATION
-
-// ================================ FUNCTIONS ==================================
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GScalableGraphics::_bind
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GRenderContext::BindL method.
- * @since Series S60 3.0
- * @param aRenderContextHandle Render context handle.
- * @param aTargetHandle Target graphics handle
- * @throws exception if not ok
-
-LOCAL_C void DoBindL(TInt aRenderContextHandle, TInt aTargetHandle, TBool aUiToolkit)
-{
- MM2GRenderContext* rc = JavaUnhand<MM2GRenderContext>(aRenderContextHandle);
- rc->BindL(aTargetHandle, aUiToolkit);
-}
-*/
-/**
- * JNI method
-
-JNIEXPORT jint JNICALL
-Java_com_nokia_microedition_m2g_M2GScalableGraphics__1bind(
- JNIEnv* aJni,
- jobject,
- jint aEventSourceHandle,
- jint aRenderContextHandle,
- jint aTargetHandle,
- jboolean aUiToolkit)
- */
-
-
-
-JNIEXPORT jint JNICALL
-Java_com_nokia_microedition_m2g_M2GScalableGraphics__1bind(
- JNIEnv* aJni,
- jobject,
- jint aRenderContextHandle,
- jint aTargetHandle )
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GScalableGraphics ) _bind - begin");
-
- TInt err = KM2GNotOk;
-
- M2G_DO_LOCK
-
- if (aRenderContextHandle)
- {
- MM2GRenderContext* rc = JavaUnhand<MM2GRenderContext>(aRenderContextHandle);
- TRAP(err,rc->BindL(aTargetHandle););
- }
-
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
- M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GScalableGraphics ) _bind: %d - end", err);
-
- return err;
-}
-
-
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GScalableGraphics::_createRenderContext
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GRenderContext::NewL method.
- * @since Series S60 3.0
- * @param aSvgProxyHandle Proxy instance.
- * @param aHandle Render context handle.
- * @throws exception if not ok
- */
-
-
-
-JNIEXPORT jint JNICALL
-Java_com_nokia_microedition_m2g_M2GScalableGraphics__1createRenderContext(
- JNIEnv* aJni,
- jobject,
- jint aSvgProxyHandle )
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GScalableGraphics ) _createRenderContext - begin");
- TInt handle = M2G_INVALID_HANDLE;
- TInt err = KM2GNotOk;
-
- M2G_DO_LOCK
-
- if (aSvgProxyHandle)
- {
- TRAP(err, MM2GRenderContext* rchandle = CM2GRenderContext::NewL(JavaUnhand<MM2GSVGProxy> (aSvgProxyHandle)); handle = JavaMakeHandle(rchandle); );
- }
- M2G_DO_UNLOCK(aJni)
-
- handle = M2GGeneral::CheckErrorCodeAndHandle(aJni, err, handle, err);
-
- M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GScalableGraphics ) _createRenderContext: %d - end", handle);
-
-
-
- return handle;
-}
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GScalableGraphics::_deleteRenderContext
-// -----------------------------------------------------------------------------
-/**
- * Class: com_nokia_microedition_m2g_M2GScalableGraphics
- * Method: deleteRenderContext
- * Signature:
- */
-JNIEXPORT void JNICALL
-Java_com_nokia_microedition_m2g_M2GScalableGraphics__1deleteRenderContext(
- JNIEnv* aJni,
- jobject,
- jint aRenderContextHandle)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GScalableGraphics ) _deleteRenderContext - begin");
-
- M2G_DO_LOCK
-
- if (aRenderContextHandle)
- {
- MM2GRenderContext* rc = JavaUnhand<MM2GRenderContext>(aRenderContextHandle);
- delete rc;
- }
- M2G_DO_UNLOCK(aJni)
-
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GScalableGraphics ) _deleteRenderContext - end");
-}
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GScalableGraphics::_release
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GRenderContext::ReleaseL method.
- * @since Series S60 3.0
- * @param aRenderContextHandle Context handle
- * @return KM2GOk if ok
- */
-
-
-/**
- * JNI method
- */
-JNIEXPORT jint JNICALL
-Java_com_nokia_microedition_m2g_M2GScalableGraphics__1release(
- JNIEnv* aJni,
- jobject,
- jint aSurfaceHandle,
- jint aRenderContextHandle)
-{
-
- // Release used target surface
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GScalableGraphics ) _release - begin");
- TInt err = KM2GNotOk;
- M2G_DO_LOCK
-
- if (aRenderContextHandle)
- {
- MM2GRenderContext* rc = JavaUnhand<MM2GRenderContext>(aRenderContextHandle);
- TRAP(err,rc->ReleaseL(););
-
- }
- M2G_DO_UNLOCK(aJni)//TODO Check for M2G_DO_LOCK M2G_DO_UNLOCK
-
- Java::GFX::WindowSurface* surf = reinterpret_cast<Java::GFX::WindowSurface*>(aSurfaceHandle);
- surf->release(); //TODO check This windows surface call detected from Graphics3d.inl
- M2GGeneral::CheckErrorCode(aJni, err);
-
- return err;
-
-}
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GScalableGraphics::_render
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GRenderContext::RenderL method.
- * @since Series S60 3.0
- * @param aRenderContextHandle Context handle
- * @param aDocumentHandle Document handle.
- * @param aSvgW Svg width.
- * @param aSvgH Svg heigth.
- * @param aCurrentTime Current time.
- * @throws Exception if not ok
- */
-
-
-/**
- * JNI method
- */
-JNIEXPORT jint JNICALL
-Java_com_nokia_microedition_m2g_M2GScalableGraphics__1renderLCDUI(
- JNIEnv* aJni,
- jobject,
- jint aRenderContextHandle,
- jint aDocumentHandle,
- jint aX, jint aY,
- jint aClipX, jint aClipY, jint aClipW, jint aClipH,
- jint aSvgW, jint aSvgH,
- jfloat aCurrentTime)
-{
- M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GScalableGraphics ) _render, time:%f - begin", aCurrentTime);
-
- TM2GRenderRect rr(aX, aY, aClipX, aClipY, aClipW, aClipH);
- TInt err = KM2GNotOk;
-
- M2G_DO_LOCK
-
- if (aRenderContextHandle && aDocumentHandle)
- {
- MM2GRenderContext* rc = JavaUnhand<MM2GRenderContext>(aRenderContextHandle);
- TRAP(err,rc->RenderLCDUIL(aDocumentHandle, aCurrentTime, aSvgW, aSvgH, rr););
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
- M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GScalableGraphics ) _render: %d - end", err);
- return err;
-}
-
-
-JNIEXPORT jintArray JNICALL
-Java_com_nokia_microedition_m2g_M2GScalableGraphics__1renderESWT(
- JNIEnv* aJni,
- jobject,
- jint aRenderContextHandle,
- jint aDocumentHandle,
- jint aX, jint aY,
- jint aClipX, jint aClipY, jint aClipW, jint aClipH,
- jint aSvgW, jint aSvgH,
- jfloat aCurrentTime,
- jint aUseNativeClear
-)
-{
- M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GScalableGraphics ) _render, time:%f - begin", aCurrentTime);
- TM2GRenderRect rr(aX, aY, aClipX, aClipY, aClipW, aClipH);
- TInt err = KM2GNotOk;
- jintArray returnDataJava = aJni->NewIntArray(10);
-
- M2G_DO_LOCK
-
- TInt returnData[10];
-
- if (aRenderContextHandle && aDocumentHandle)
- {
- MM2GRenderContext* rc = JavaUnhand<MM2GRenderContext>(aRenderContextHandle);
- TRAP(err,rc->RenderESWTL(aDocumentHandle,aCurrentTime,aSvgW,aSvgH,rr,aUseNativeClear,returnData););
- }
- M2G_DO_UNLOCK(aJni)
-
-
- if (returnDataJava != NULL)
- aJni->SetIntArrayRegion(returnDataJava, 0, 10, const_cast<TInt*>(returnData));
-
- M2GGeneral::CheckErrorCode(aJni, err);
- M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GScalableGraphics ) _render: %d - end", err);
- return returnDataJava;
-}
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GScalableGraphics::_setRenderingQuality
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GRenderContext::SetRenderingQuality method.
- * @since Series S60 3.0
- * @param aRenderContextHandle Context handle
- * @param aMode
- * @throws Exception if not ok
- */
-JNIEXPORT void JNICALL
-Java_com_nokia_microedition_m2g_M2GScalableGraphics__1setRenderingQuality(
- JNIEnv* aJni,
- jobject,
- jint aRenderContextHandle, jint aMode)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GScalableGraphics ) _setRenderingQuality - begin");
- TInt err = KM2GNotOk;
-
- M2G_DO_LOCK
-
- if ( aRenderContextHandle)
- {
- MM2GRenderContext* rc = JavaUnhand<MM2GRenderContext>(aRenderContextHandle);
- TRAP(err,rc->SetRenderingQualityL(aMode););
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
-
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GScalableGraphics ) _setRenderingQuality - end");
-}
-
-// -----------------------------------------------------------------------------
-// Java_com_nokia_microedition_m2g_M2GScalableGraphics::_setTransparency
-// -----------------------------------------------------------------------------
-/**
- * Calls MM2GRenderContext::SetTransparency method.
- * @since Series S60 3.0
- * @param aRenderContextHandle Context handle
- * @param aAplha -
- */
-JNIEXPORT void JNICALL
-Java_com_nokia_microedition_m2g_M2GScalableGraphics__1setTransparency(
- JNIEnv* aJni,
- jobject,
- jint aRenderContextHandle,
- jfloat aAlpha)
-{
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GScalableGraphics ) _setTransparency - begin");
- TInt err = KM2GNotOk;
-
- M2G_DO_LOCK
-
- if (aRenderContextHandle)
- {
- MM2GRenderContext* rc = JavaUnhand<MM2GRenderContext>(aRenderContextHandle);
- TRAP(err,rc->SetTransparency( (TReal32)aAlpha ););
- }
- M2G_DO_UNLOCK(aJni)
-
- M2GGeneral::CheckErrorCode(aJni, err);
-
- M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GScalableGraphics ) _setTransparency - end");
-}
-
-M2G_NS_END
-
-
-