Example: Java Properties Manager

This is what a Java Properties Manager code might look like

package com.ibm.as400.opnav.Sample;

import com.ibm.as400.opnav.*;

import java.awt.Frame;

import com.ibm.as400.ui.framework.java.*;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class SamplePropertiesManager implements
PropertiesManager
{

// The list of selected objects.
ObjectName[] m_objectNames;

// Save the array of selected object names
//
public void initialize(ObjectName[] objectNames)
{

m_objectNames = objectNames;

}

// Return an array of Panel Managers
//
public PanelManager[] getPages()
{

// Instantiate the data beans
MyDataBean dataBean = new MyDataBean();
dataBean.load();
AnotherDataBean dataBean2 = new AnotherDataBean();
dataBean2.load();

DataBean[] dataBeans = { dataBean };
DataBean[] dataBeans2 = { dataBean2 };

// Create the panel
PanelManager pm = null;
PanelManager pm2 = null; try
{

pm = new PanelManager("com.ibm.as400.opnav.Sample.Sample",
"PAGE1",
dataBeans);

pm2 = new PanelManager("com.ibm.as400.opnav.Sample.Sample",
"PAGE2",
dataBeans2);


}

catch (com.ibm.as400.ui.framework.java.DisplayManagerException
e)
{

Monitor.logError("SamplePropertiesManager: Exception when
creating pages "+e);

}

pm.setTitle("First Java Page");
pm2.setTitle("Second Java Page");

PanelManager[] PMArray = {pm, pm2};

return PMArray;

}

// Return a list of ActionListener objects to be notified when
commit is processed

public ActionListener[] getCommitListeners()
{

ActionListener[] al = new ActionListener[1];
al[0] = new ActionListener()
{

public void actionPerformed(ActionEvent evt)
{

Monitor.logError("SamplePropertiesManager: Processing Commit
Listener");

}

};
return al;

}
// Return a list of ActionListener objects to be notified when
cancel is selected
public ActionListener[] getCancelListeners()
{

ActionListener[] al = new ActionListener[1];
al[0] = new ActionListener()
{

public void actionPerformed(ActionEvent evt)
{

Monitor.logError("SamplePropertiesManager: Processing Cancel
Listener");

}

};
return al;

}

}
Related concepts
Property sheet handling in Java