Dépôt officiel du code source de l'ERP OpenConcerto
Blame | Last modification | View Log | RSS feed
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each file.
*/
package org.openconcerto.sql.ui;
import org.openconcerto.ui.ColorField;
import org.openconcerto.ui.valuewrapper.ValueWrapper;
import org.openconcerto.utils.checks.ValidListener;
import org.openconcerto.utils.checks.ValidState;
import java.awt.Color;
import java.beans.PropertyChangeListener;
import javax.swing.JComponent;
public class IColorChooser extends ColorField implements ValueWrapper<Integer> {
public IColorChooser(String title) {
super(title);
}
@Override
public JComponent getComp() {
return this;
}
@Override
public ValidState getValidState() {
return ValidState.getTrueInstance();
}
@Override
public void setValue(Integer val) {
if (val == null) {
val = Color.WHITE.getRGB();
}
setColor(new Color(val));
}
@Override
public Integer getValue() {
if (getColor() == null) {
return null;
} else {
return getColor().getRGB();
}
}
@Override
public void addValidListener(ValidListener l) {
// TODO Auto-generated method stub
}
@Override
public void removeValidListener(ValidListener l) {
// TODO Auto-generated method stub
}
@Override
public void resetValue() {
this.setColor(null);
}
@Override
public final void addValueListener(final PropertyChangeListener l) {
this.addPropertyChangeListener("value", l);
}
@Override
public void rmValueListener(final PropertyChangeListener l) {
this.removePropertyChangeListener("value", l);
}
}