[Home] DMelt member access. Java source code: org.jhotdraw.draw.action.SelectionColorChooserHandler
/**
* @(#)SelectionColorChooserHandler.java
*
* Copyright (c) 2010 by the original authors of JHotDraw and all its
* contributors. All rights reserved.
*
* You may not use, copy or modify this file, except in compliance with the
* license agreement you entered into with the copyright holders. For details
* see accompanying license terms.
*/
package org.jhotdraw.draw.action;
import javax.swing.event.ChangeEvent;
import javax.swing.undo.*;
import javax.swing.*;
import java.util.*;
import java.awt.*;
import javax.swing.event.ChangeListener;
import org.jhotdraw.draw.*;
/**
* SelectionColorChooserHandler.
*
* @author Werner Randelshofer
* @version $Id$
*/
public class SelectionColorChooserHandler extends AbstractSelectedAction
implements ChangeListener {
protected AttributeKey key;
protected JColorChooser colorChooser;
protected JPopupMenu popupMenu;
protected int isUpdating;
//protected Map attributes;
/** Creates a new instance. */
public SelectionColorChooserHandler(DrawingEditor editor, AttributeKey key, JColorChooser colorChooser, JPopupMenu popupMenu) {
super(editor);
this.key = key;
this.colorChooser = colorChooser;
this.popupMenu = popupMenu;
//colorChooser.addActionListener(this);
colorChooser.getSelectionModel().addChangeListener(this);
updateEnabledState();
}
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
/*
if (evt.getActionCommand() == JColorChooser.APPROVE_SELECTION) {
applySelectedColorToFigures();
} else if (evt.getActionCommand() == JColorChooser.CANCEL_SELECTION) {
}*/
popupMenu.setVisible(false);
}
protected void applySelectedColorToFigures() {
final ArrayList selectedFigures = new ArrayList(getView().getSelectedFigures());
final ArrayList