![JAR search and dependency download from the Maven repository](/logo.png)
com.viaoa.hub.SharedHub Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of oa-core Show documentation
Show all versions of oa-core Show documentation
Object Automation library
/* Copyright 1999 Vince Via [email protected]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package com.viaoa.hub;
/**
Used for sharing the same objects that are in another Hub, with or without using the same active object.
As changes are made to the objects, both/all Hubs will be notified.
Shared Hubs are useful in GUI applications where the same collection of objects are needed for different purposes.
Example:
A JTable that uses a Hub of Department objects to display and maintain all of the Departments.
A shared Hub could be created to use the same objects in a drop down list to select the Department for an
Employee. Both Hubs would be using the same objects, but for different purposes.
Hub hubDepartment = new Hub(Department.class);
hubDepartment.select();
SharedHub hubDepartment2 = new SharedHub(hubDepartment);
@since 2004/03/19 using methods built into Hub. see {@link Hub#createSharedHub}
@see Hub
*/
public class SharedHub extends Hub {
/**
Create a Hub that uses the same data/objects as another Hub.
@param hub is the Hub that will be shared with.
*/
public SharedHub(Hub hub) {
this(hub, false);
}
/**
Create a Hub that uses the same data/objects as another Hub.
@param hub is the Hub that will be shared with.
@param bShareActiveObject if true then this Hub will also share/use the same active object as the hub. Default is false.
*/
public SharedHub(Hub hub, boolean bShareActiveObject) {
if (hub != null) {
HubDelegate.setObjectClass(this, hub.getObjectClass());
HubShareDelegate.setSharedHub(this, hub, bShareActiveObject);
}
}
/**
Create a Hub that will use the same data/objects as another Hub.
*/
public SharedHub(Class c) {
super(c);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy