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