use of javax.swing.event.ChangeListener in project jgnash by ccavanaugh.
the class JideSwingUtilities method synchronizeView.
/**
* Synchronizes the two viewports. The view position changes in the master view, the slave view's view position will
* change too. Generally speaking, if you want the two viewports to synchronize vertically, they should have the
* same height. If horizontally, the same width.
* <p>
* It's OK if you call this method with the same master viewport and slave viewport duplicate times. It won't cause
* multiple events fired.
*
* @param masterViewport the master viewport
* @param slaveViewport the slave viewport
* @param orientation the orientation. It could be either SwingConstants.HORIZONTAL or SwingConstants.VERTICAL.
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public static void synchronizeView(final JViewport masterViewport, final JViewport slaveViewport, final int orientation) {
if (masterViewport == null || slaveViewport == null) {
return;
}
ChangeListener[] changeListeners = masterViewport.getChangeListeners();
int i = 0;
for (; i < changeListeners.length; i++) {
if (changeListeners[i] == getViewportSynchronizationChangeListener()) {
break;
}
}
if (i >= changeListeners.length) {
masterViewport.addChangeListener(getViewportSynchronizationChangeListener());
}
Object property = masterViewport.getClientProperty(JideScrollPane.CLIENT_PROPERTY_SLAVE_VIEWPORT);
if (!(property instanceof Map)) {
property = new HashMap<JViewport, Integer>();
}
Map<JViewport, Integer> slaveViewportMap = (Map) property;
slaveViewportMap.put(slaveViewport, orientation);
masterViewport.putClientProperty(JideScrollPane.CLIENT_PROPERTY_SLAVE_VIEWPORT, slaveViewportMap);
property = slaveViewport.getClientProperty(JideScrollPane.CLIENT_PROPERTY_MASTER_VIEWPORT);
if (!(property instanceof Map)) {
property = new HashMap<JViewport, Integer>();
}
Map<JViewport, Integer> masterViewportMap = (Map) property;
masterViewportMap.put(masterViewport, orientation);
slaveViewport.putClientProperty(JideScrollPane.CLIENT_PROPERTY_MASTER_VIEWPORT, masterViewportMap);
}
use of javax.swing.event.ChangeListener in project processdash by dtuma.
the class TeamTimePanel method applySubteamFilter.
public void applySubteamFilter(Set<Integer> subteamFilter, String subteamName) {
this.teamMemberFilter = null;
this.subteamFilter = subteamFilter;
this.subteamName = subteamName;
this.teamList.setSubteamFilter(subteamFilter);
rebuildPanelContents();
ChangeEvent evt = new ChangeEvent(this);
for (ChangeListener l : listenerList.getListeners(ChangeListener.class)) l.stateChanged(evt);
}
use of javax.swing.event.ChangeListener in project processdash by dtuma.
the class AbstractEVChart method fireStateChanged.
protected void fireStateChanged() {
if (changeListeners != null) {
List<ChangeListener> listeners = new ArrayList<ChangeListener>(changeListeners);
ChangeEvent evt = new ChangeEvent(this);
for (ChangeListener l : listeners) l.stateChanged(evt);
}
}
use of javax.swing.event.ChangeListener in project processdash by dtuma.
the class TeamMemberColumnManager method createColumns.
/** Create or recreate TeamMemberTimeColumn objects for each team member
*/
private void createColumns() {
List<TeamMemberTimeColumn> obsoletePlanTimeColumns = planTimeColumnList;
List<TeamMemberActualTimeColumn> obsoleteActualTimeColumns = actualTimeColumnList;
ArrayList newColumns = new ArrayList();
planTimeColumnList = new ArrayList<TeamMemberTimeColumn>();
actualTimeColumnList = new ArrayList<TeamMemberActualTimeColumn>();
Iterator teamMembers = teamList.getTeamMembers().iterator();
while (teamMembers.hasNext()) {
// Loop through the list of team members.
TeamMember m = (TeamMember) teamMembers.next();
// try to find a preexisting planned time column for this team member.
TeamMemberTimeColumn planTimeCol = getExistingValidTimeColumn(obsoletePlanTimeColumns, m);
if (planTimeCol == null) {
// create a new column for this team member.
planTimeCol = new TeamMemberTimeColumn(dataModel, m);
newColumns.add(planTimeCol);
}
// add the column to our master list.
planTimeColumnList.add(planTimeCol);
// try to find a preexisting actual time column for this team member.
TeamMemberActualTimeColumn actualTimeCol = getExistingValidTimeColumn(obsoleteActualTimeColumns, m);
if (actualTimeCol == null) {
// create a new column for this team member.
actualTimeCol = new TeamMemberActualTimeColumn(m);
newColumns.add(actualTimeCol);
}
// add the column to our master list.
actualTimeColumnList.add(actualTimeCol);
}
// make the changes to the columns in the data model.
if (!newColumns.isEmpty() || !obsoletePlanTimeColumns.isEmpty() || !obsoleteActualTimeColumns.isEmpty()) {
List obsoleteColumns = new ArrayList();
obsoleteColumns.addAll(obsoletePlanTimeColumns);
obsoleteColumns.addAll(obsoleteActualTimeColumns);
dataModel.addRemoveDataColumns(newColumns, obsoleteColumns);
}
// alert any listeners that have registered interest
ChangeEvent e = new ChangeEvent(this);
for (ChangeListener l : listeners) l.stateChanged(e);
}
use of javax.swing.event.ChangeListener in project processdash by dtuma.
the class GroupFilterMenu method setSelectedItem.
public void setSelectedItem(UserFilter selection) {
if (selection instanceof UserGroup) {
UserGroup g = (UserGroup) selection;
setIcon(groupIcon);
setText(g.toString());
} else if (selection instanceof UserGroupMember) {
UserGroupMember m = (UserGroupMember) selection;
setIcon(personIcon);
setText(m.toString());
}
boolean isChange = !NullSafeObjectUtils.EQ(selectedItem, selection);
this.selectedItem = selection;
if (isChange) {
for (ChangeListener l : listeners.getListeners(ChangeListener.class)) l.stateChanged(new ChangeEvent(this));
}
}
Aggregations