Many ALI development topics use UI customization sample code in the SampleProjects-60x.zip available on the ALUI Developer Center on dev2dev, in the Code Samples directory. The instructions that follow explain how to install the files and add the projects to your IDE. The default file locations are shown below:
Note: In most cases, you should first set up your IDE for portal development as explained in the Setting Up the Java Development Portal.
The sample code package includes the following projects:
sampleactivityspace illustrates how to create a custom Activity Space.
sampleagreementlogin shows how to block access to the portal based on acceptance of terms and conditions. For details, see the README.txt in the project directory.
sampleloginpei illustrates how to implement a login PEI (Programmable Event Interface).
sampleplugnav shows how to create a custom navigation scheme.
samplenavmsg shows how to use a custom navigation scheme to display messages on every page. For details, see the README.txt in the project directory.
samplenavmsgnovarpack extends one of the portal's navigation schemes. For details, see the README.txt in the project directory.
sampleproject shows how to create a custom project.
sampleredirectpei shows how to use a PEI (Programmable Event Interface) to redirect on login.
sampleselectstartpage shows how add a portal page that allows users to select their home community. For details, see the README.txt in the project directory.
samplesubportalguests shows how to implement multiple branded login pages. Note: This customization can now be completed without any code using experience definitions.
sampletag shows how to create a vertical navigation bar with adaptive tags.
samplevarpack illustrates how to implement a variable package (varpack).
sampleview shows how to replace the login view with a custom view.
To prepare the samples for running:
to a new SAMPLE_HOME location (for example, C:\Sample Code). The directory
structure created will include \ptwebui-samples, \_buildcommon, and \_local_repository.
Warning: Do not unzip the samples on top of the UI source code directory (SOURCE_HOME); they will conflict with existing build scripts.
Confirm that you are using Ant 1.6.2 and Java JDK 1.4.2 or above. You must configure ANT_HOME and JAVA_HOME to point to the respective home directories (for example, ANT_HOME=c:\jakarta-ant-1.6.2).
Make sure your JDK’s bin directory is on your PATH. Test it by trying to run the JDK application “jar” from the command line.
Build the samples by
navigating to SAMPLE_HOME and
typing the following:
This will create a new subdirectory in SAMPLE_HOME called \buildoutput\java-samples that contains the sample JAR files.
To import the sample code into Eclipse:
Extract SampleProjects-60x.zip to SOURCE_HOME\portalui\6.0.
Warning: This will overwrite some of the existing build files with new ones that contain targets for the sample projects. If you have previously downloaded the sample code and modified these files to add your own custom projects, your modifications will be overwritten.
Open Eclipse, and click File | Import | Existing Project into Workspace.
Browse to the \java subdirectory of the project you want to import in SOURCE_HOME (i.e., \plumtree_ui_source\sampleview\java).
Click OK and Finish.
Last, deploy the sample code JARs. Since the sample jar files must be accessible to both your Web application server (BEA, WebSphere, Tomcat) and the portal's Dynamic Discovery loader, you must copy the sample JARs to two locations.
Copy the sample JARs from SAMPLE_HOME\buildoutput\java-samples to PORTAL_HOME\lib\java so they can be accessed by the portal's Dynamic Discovery mechanism.
Add the JARs to your Web application server using the instructions below:
Change directories to PORTAL_HOME\webapp.
Move or delete the .ear file.
Unzip the WAR file using Java’s JAR command:
jar –xvf portal.war
Copy the sample JAR files from SAMPLE_HOME\buildoutput\java-samples to PORTAL_HOME\webapp\WEB-INF\lib.
Re-zip the WAR file using the JAR command:
jar –cvf portal.war *.*
Add the sample projects to the debug configuration:
In Eclipse, go to Run - Debug and open the Tomcat debug configuration (created during the UICI installation process).
Go to the classpath tab and select User Entries. Click Add Projects and add any sample projects you want to debug.
Once you have made these changes, you can use the sample code.
Next: Creating a Custom Project