初篇学习potomac-framework

  注:本文只作本人记录,不作为技术分享。

        

 

      固定链接: http://www.nethref.com/?p=281

 

      官方网址:http://www.potomacframework.org/

      下载地址:http://www.potomacframework.org/downloads/

      论坛讨论:http://forum.potomacframework.org/

      API文档:http://www.potomacframework.org/1.0beta/asdoc

      学习文档:http://www.potomacframework.org/documentation/

 

 

      potomac-framework源于目前多种技术的设计思想,类似于OSGI和Eclipse RCP技术,适合做企业级Flex模块块的开发,但目前最新版是Beta 0.8版,只建议学习研究,不做实际项目应用。

 

      第一、Flex的potomac-framework中一个模块化的框架,参考OSGI的原理,而其构建成用户的UI界面,则是由”parts(组件)“拼装而成。这点相信有Eclipse的使用经验的朋友都明白。

      第二、potomac-framework是一种通用的商用应用Flex程序框架,拥有框架的依赖注入及支持反射和可扩展机制。

 

      第三、总体来说,potomac的设计思想是很优秀的,是值得推荐理由。但目前其拥的多种机制都还不成熟。如果企业或团体需要应用,则需要自己实现他的扩展机制。

 

   如何搭建potomac的开发环境,在官网上已有详细的文档体现。具体页面为:http://www.potomacframework.org/documentation/getting-started/,但我还是把内容再贴出来吧。

 

    1、做好环境搭建准备

          安装Java SDK

          下载 Potomac  立即下载 

          安装好Flash Builder4或Eclipse

          安装Potomac基于Eclipse的插件,老版本Eclise放在Plugins中而新版本的放在Dropins,插件在下载好的PhotoMac包中有为”com.elementriver.potomac.sdk_1.0.0_vXXXXXX.jar

 

    2、然后配制PhotoMac的开发平台

         在Window下的Perferences中,指定Potomac解压位置中的targetPlatform目录。

        不清楚可参考:http://www.potomacframework.org/documentation/modularity/about-the-target-platform/

 

 

接下来就是创建应用了,这里我就不多说了,英语不难,大家都看的懂。把这例子跑起来后再细读官方文档和API吧。

 

 

Create a Bundle
Potomac projects are composed of bundles (i.e. Potomac modules). Bundles are hosted within Flex Library Projects.

Create a new Flex Library Project.

Once the library project is created, you need to add the Potomac Bundle Nature to it.

Right-click on the project and select the new “Add Potomac Bundle Nature”.

When that is complete, you should notice that Potomac created a new file named “bundle.xml” in the project’s root folder.



Configure the Bundle
Now you’ll need to perform some standard configuration to the bundle. Open the bundle.xml file.

In the Bundle XML Editor, add the two Potomac bundles, potomac_core and potomac_ui, to the dependencies list. Click save.





Add a Sample Component
You’ll need to add at least on UI component to see anything on screen. Here’s a simple one you can cut-n-paste in called MyComponent.mxml:

<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300">
	<mx:Metadata>
		[Page(id="hellopage",title="Hello World")]
		[Part(id="hellopart",page="hellopage",
		      folder="default",title="Hello World")]		
	</mx:Metadata>
	<mx:Label x="10" y="10" text="Hello World"/>
</mx:Canvas>




Create an Application
A Potomac application is a normal Flex Project with the Potomac Application Nature. Create a Flex Project, then right-click on the project and select “Add Potomac Application Nature”.





Configure the Application
Open the newly created appManifest.xml. This file is used to configure your Potomac application.

Add potomac_ui, potomac_ui_templates_dark, and your newly created bundle to the manifest’s bundle list.

Set potomac_ui and potomac_ui_templates_dark to load as RSLs.

Now select the potomac_dark template (it became available after we included the potomac_ui_templates_dark bundle). Click save.

Lastly, you’ll need one Potomac stub to the application’s main mxml file. Simply add an instance of the PotomacInitializer like:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" 
	layout="absolute" xmlns:derived="potomac.derived.*">
	<derived:PotomacInitializer/>
</mx:Application>




Run the Application
Now you’re ready to run the application



Importing the Sample Project

Potomac comes with a (hopefully) easy to follow sample project.

The sample project includes two bundles and one application.

To import the sample app into FlexBuilder, click on File – Import…

Select General – Existing Projects Into Workspace.

Select the “exampleApp” folder that was extracted from the potomac zip file for the root directory.

Check the “Copy projects into workspace” option.

Click Finish.

Once the projects import and rebuild, you should be able to run the sample appication.

 

 

          源文固定链接: http://www.nethref.com/?p=281

 

 

 

《C++编程实例100》是一本深入实践、极具价值的编程教程,它针对C++编程语言提供了丰富的实例,旨在帮助读者更好地理解和掌握C++的各项特性与编程技巧。这本书的经典之处在于它将理论与实践相结合,通过100个精心设计的编程实例,覆盖了C++的各个核心领域,包括基础语法、面向对象编程、模板、异常处理、STL(标准模板库)等。 我们来探讨C++的基础语法。C++是C语言的增强版,它保留了C语言的高效性和灵活性,并引入了类、对象和继承等面向对象编程概念。基础语法包括变量声明、数据类型、运算符、控制结构(如if语句、for循环、while循环)、函数的定义和调用等。在实例中,你可能会遇到如何编写简单的程序,如计算两个数的和,或者实现一个简单的猜数字游戏。 C++的面向对象编程是其一大特色。通过类和对象,你可以构建复杂的软件系统。类是对象的蓝图,它定义了对象的属性和行为。实例化一个类,就是创建一个具体的对象。继承允许你创建新的类,这些类从现有的类派生,共享其属性和方法,同时可以添加新的功能。多态性是面向对象的另一个关键特性,它使得不同类型的对象可以对同一消息作出不同的响应。这些概念在实例中会以各种形式展现,例如设计一个图形界面的类层次,或实现一个简单的模拟游戏。 接下来是模板,C++的模板功能让代码更加通用,可以处理不同类型的数据。模板分为函数模板和类模板,前者可以创建泛型函数,后者可以创建泛型类。通过模板,你可以编写出高效且灵活的代码,比如实现一个通用的排序算法。 异常处理是C++中用于处理程序运行时错误的机制。当程序出现异常情况时,可以抛出一个异常,然后在适当的点捕获并处理这个异常。这使得代码能够优雅地处理错误,而不是让程序崩溃。实例中可能会有涉及文件操作或网络通信时可能出现的异常处理示例。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值