|
|
|
@ -3,15 +3,6 @@
|
|
|
|
|
*/ |
|
|
|
|
package com.fr.design.style.color; |
|
|
|
|
|
|
|
|
|
import java.awt.Color; |
|
|
|
|
import java.awt.event.FocusEvent; |
|
|
|
|
import java.awt.event.FocusListener; |
|
|
|
|
|
|
|
|
|
import javax.swing.Icon; |
|
|
|
|
import javax.swing.event.ChangeEvent; |
|
|
|
|
import javax.swing.event.ChangeListener; |
|
|
|
|
import javax.swing.event.EventListenerList; |
|
|
|
|
|
|
|
|
|
import com.fr.base.BaseUtils; |
|
|
|
|
import com.fr.design.event.UIObserver; |
|
|
|
|
import com.fr.design.event.UIObserverListener; |
|
|
|
@ -20,6 +11,15 @@ import com.fr.design.gui.ibutton.UIColorButton;
|
|
|
|
|
import com.fr.design.gui.ibutton.UICombinationButton; |
|
|
|
|
import com.fr.design.gui.ipoppane.PopupHider; |
|
|
|
|
import com.fr.design.utils.gui.GUICoreUtils; |
|
|
|
|
import com.fr.stable.os.OperatingSystem; |
|
|
|
|
|
|
|
|
|
import javax.swing.Icon; |
|
|
|
|
import javax.swing.event.ChangeEvent; |
|
|
|
|
import javax.swing.event.ChangeListener; |
|
|
|
|
import javax.swing.event.EventListenerList; |
|
|
|
|
import java.awt.Color; |
|
|
|
|
import java.awt.event.FocusEvent; |
|
|
|
|
import java.awt.event.FocusListener; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Color select pane2. |
|
|
|
@ -33,7 +33,6 @@ public class UIToolbarColorButton extends UICombinationButton implements PopupHi
|
|
|
|
|
private EventListenerList colorChangeListenerList = new EventListenerList(); |
|
|
|
|
private UIObserverListener uiObserverListener; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public UIToolbarColorButton(Icon icon) { |
|
|
|
|
super(new UIColorButton(icon), new UIButton(BaseUtils.readIcon("/com/fr/design/images/gui/popup.gif"))); |
|
|
|
|
getLeftButton().setEventBanned(true); |
|
|
|
@ -66,24 +65,17 @@ public class UIToolbarColorButton extends UICombinationButton implements PopupHi
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
/** |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
public UIColorButton getLeftButton() { |
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
return (UIColorButton) super.getLeftButton(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public Color getColor() { |
|
|
|
|
return this.color; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @param color |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public void setColor(Color color) { |
|
|
|
|
setColorWithoutchanged(color); |
|
|
|
|
fireColorStateChanged(); |
|
|
|
@ -91,6 +83,7 @@ public class UIToolbarColorButton extends UICombinationButton implements PopupHi
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 设置颜色 |
|
|
|
|
* |
|
|
|
|
* @param color 颜色 |
|
|
|
|
*/ |
|
|
|
|
public void setColorWithoutchanged(Color color) { |
|
|
|
@ -100,6 +93,7 @@ public class UIToolbarColorButton extends UICombinationButton implements PopupHi
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 是否可为NULL值 |
|
|
|
|
* |
|
|
|
|
* @return 同上 |
|
|
|
|
*/ |
|
|
|
|
public boolean isCanBeNull() { |
|
|
|
@ -114,9 +108,6 @@ public class UIToolbarColorButton extends UICombinationButton implements PopupHi
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
/** |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
public void setEnabled(boolean enabled) { |
|
|
|
|
super.setEnabled(enabled); |
|
|
|
|
|
|
|
|
@ -129,9 +120,6 @@ public class UIToolbarColorButton extends UICombinationButton implements PopupHi
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
/** |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
public void setToolTipText(String tooltipText) { |
|
|
|
|
getLeftButton().setToolTipText(tooltipText); |
|
|
|
|
getLeftButton().setToolTipText(tooltipText); |
|
|
|
@ -155,8 +143,9 @@ public class UIToolbarColorButton extends UICombinationButton implements PopupHi
|
|
|
|
|
/** |
|
|
|
|
* 隐藏弹出框 |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public void hidePopupMenu() { |
|
|
|
|
if (popupWin != null) { |
|
|
|
|
if (popupWin != null && !OperatingSystem.isMacos()) { |
|
|
|
|
popupWin.setVisible(false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -181,6 +170,7 @@ public class UIToolbarColorButton extends UICombinationButton implements PopupHi
|
|
|
|
|
/** |
|
|
|
|
* Adds a new ColorChangeListener |
|
|
|
|
* 注册监听 |
|
|
|
|
* |
|
|
|
|
* @param changeListener 监听 |
|
|
|
|
*/ |
|
|
|
|
public void addColorChangeListener(ChangeListener changeListener) { |
|
|
|
@ -190,6 +180,7 @@ public class UIToolbarColorButton extends UICombinationButton implements PopupHi
|
|
|
|
|
/** |
|
|
|
|
* Removes an old ColorChangeListener. |
|
|
|
|
* 移除监听 |
|
|
|
|
* |
|
|
|
|
* @param changeListener 监听 |
|
|
|
|
*/ |
|
|
|
|
public void removeColorChangeListener(ChangeListener changeListener) { |
|
|
|
@ -198,7 +189,6 @@ public class UIToolbarColorButton extends UICombinationButton implements PopupHi
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 触发颜色改变事件 |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
public void fireColorStateChanged() { |
|
|
|
|
Object[] listeners = colorChangeListenerList.getListenerList(); |
|
|
|
@ -214,6 +204,7 @@ public class UIToolbarColorButton extends UICombinationButton implements PopupHi
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
protected void leftButtonClickEvent() { |
|
|
|
|
color = getLeftButton().getColor(); |
|
|
|
|
fireColorStateChanged(); |
|
|
|
@ -224,29 +215,32 @@ public class UIToolbarColorButton extends UICombinationButton implements PopupHi
|
|
|
|
|
showPopupMenu(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
/** |
|
|
|
|
* 选中颜色 |
|
|
|
|
* |
|
|
|
|
* @param colorCell 颜色单元格 |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public void colorSetted(ColorCell colorCell) { |
|
|
|
|
hidePopupMenu(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
/** |
|
|
|
|
* 注册监听 |
|
|
|
|
* |
|
|
|
|
* @param listener 监听 |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public void registerChangeListener(UIObserverListener listener) { |
|
|
|
|
uiObserverListener = listener; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
/** |
|
|
|
|
* 是否响应监听 |
|
|
|
|
* |
|
|
|
|
* @return 同上 |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public boolean shouldResponseChangeListener() { |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|