コード例 #1
0
void VJSGlobalClass::do_ProgressIndicator(VJSParms_callStaticFunction& ioParms, VJSGlobalObject *inContext)
{
	VString sessiontile;
	VString windowtile, userinfo;
	bool caninterrupt = false;
	Real maxvalue = -1;
	VError err = VE_OK;
	
	if (ioParms.IsNumberParam(1))
		ioParms.GetRealParam(1, &maxvalue);
	else
		err = vThrowError(VE_JVSC_WRONG_PARAMETER_TYPE_NUMBER, "1");

	if (err == VE_OK )
	{
		if (ioParms.IsStringParam(2))
			ioParms.GetStringParam(2, sessiontile);
		else
			err = vThrowError(VE_JVSC_WRONG_PARAMETER_TYPE_STRING, "2");
	}

	caninterrupt = ioParms.GetBoolParam( 3, L"Can Interrupt", "Cannot Interrupt");

		
	//VProgressIndicator* progress = inContext->GetRuntimeDelegate()->CreateProgressIndicator( windowtile);

	if (err == VE_OK)
	{
		VProgressIndicator* progress = new VProgressIndicator();
		if (progress != NULL)
		{
			if (ioParms.CountParams() >= 4)
			{
				if (ioParms.IsStringParam(4))
				{
					ioParms.GetStringParam(4, windowtile);
					progress->SetTitle(windowtile);
				}
				else
					vThrowError(VE_JVSC_WRONG_PARAMETER_TYPE_STRING, "4");
			}
			if (ioParms.CountParams() >= 5)
			{
				if (ioParms.IsStringParam(5))
				{
					ioParms.GetStringParam(5, userinfo);
					progress->SetUserInfo(userinfo);
				}
				else
					vThrowError(VE_JVSC_WRONG_PARAMETER_TYPE_STRING, "5");
			}
			progress->BeginSession((sLONG8)maxvalue, sessiontile, caninterrupt);
		}
		ioParms.ReturnValue(VJSProgressIndicator::CreateInstance(ioParms.GetContextRef(), progress));
		
		ReleaseRefCountable( &progress);
	}
	else
		ioParms.ReturnNullValue();	
}	
コード例 #2
0
void VJSStream::do_BinaryStream(VJSParms_callStaticFunction& ioParms)
{
	VFile* file = ioParms.RetainFileParam( 1);
	bool forwrite = ioParms.GetBoolParam( 2, L"Write", L"Read");
	if (file != NULL)
	{
		VError err = VE_OK;
		if (forwrite)
		{
			if (!file->Exists())
				err = file->Create();
		}
		VFileStream* stream = new VFileStream(file);
		if (err == VE_OK)
		{
			if (forwrite)
				err = stream->OpenWriting();
			else
				err = stream->OpenReading();
		}
		
		if (err == VE_OK)
		{
			ioParms.ReturnValue(VJSStream::CreateInstance(ioParms.GetContextRef(), stream));
		}
		else
		{
			delete stream;
		}
	}
	else
		vThrowError(VE_JVSC_WRONG_PARAMETER_TYPE_FILE, "1");
	ReleaseRefCountable( &file);
}
コード例 #3
0
void VJSDataServiceCore::_setEnabled( VJSParms_callStaticFunction& ioParms, VDataService *inService)
{
	VRIAContext *riaContext = VRIAJSRuntimeContext::GetApplicationContextFromJSContext( ioParms.GetContext(), inService->GetApplication());

	bool enabled = false;
	if (ioParms.GetBoolParam( 1, &enabled))
	{
		inService->SetEnabled( enabled);
	}
}
コード例 #4
0
ファイル: JsUAG.cpp プロジェクト: StephaneH/core-Components
void VJSDirectory::_filterGroups(VJSParms_callStaticFunction& ioParms, CUAGDirectory* inDirectory)
{
	VString s;
	bool isquery = false;
	ioParms.GetStringParam(1, s);
	isquery = ioParms.GetBoolParam(2, "query", "not query");
	CUAGGroupVector groups;
	VError err = inDirectory->FilterGroups(s, isquery, groups);

	ioParms.ReturnValue(buildArrFromGroups(ioParms, groups, nil));
}
コード例 #5
0
void VJSGlobalClass::do_include( VJSParms_callStaticFunction& inParms, VJSGlobalObject *inGlobalObject)
{
	// EvaluateScript() uses NULL (this is default) as inThisObject argument. 
	// This works fine currently, but would it be better (if any problem) to pass global (application) object instead? 
	// See WAK0074064.

	VFile* file = inParms.RetainFileParam(1, false);
	if (file != NULL)
	{
		bool newlyRegistered = inGlobalObject->RegisterIncludedFile( file);		// sc 15/06/2010 the file must be registered
		if (inParms.GetBoolParam(2,"refresh","auto") || newlyRegistered)
		{
			inParms.GetContext().EvaluateScript( file, NULL, inParms.GetExceptionRefPointer());
		}
		file->Release();
	}
	else
	{
		VString pathname;
		if (inParms.IsStringParam(1) && inParms.GetStringParam( 1, pathname))
		{
			VFolder* folder = inGlobalObject->GetRuntimeDelegate()->RetainScriptsFolder();
			if (folder != NULL)
			{
				file = new VFile( *folder, pathname, FPS_POSIX);
				
				bool newlyRegistered = inGlobalObject->RegisterIncludedFile( file);		// sc 15/06/2010 the file must be registered
				if (inParms.GetBoolParam(2,"refresh","auto") || newlyRegistered)
				{
					inParms.GetContext().EvaluateScript( file, NULL, inParms.GetExceptionRefPointer());
				}
				ReleaseRefCountable( &file);
			}
			ReleaseRefCountable( &folder);
		}
		else
			vThrowError(VE_JVSC_WRONG_PARAMETER_TYPE_FILE, "1");
	}
}
コード例 #6
0
void VJSGlobalClass::do_displayNotification( VJSParms_callStaticFunction& inParms, VJSGlobalObject*)
{
	VString message;
	inParms.GetStringParam( 1, message);
	
	VString title( "Notification");
	inParms.GetStringParam( 2, title);
	
	bool critical = false;
	inParms.GetBoolParam( 3, &critical);

	VSystem::DisplayNotification( title, message, critical ? EDN_StyleCritical : 0);
}