forked from fanruan/design
Browse Source
* commit 'f4b02049b70c5dfa2e82481922f3b41c076df17d': get改为update 方法重命名 沿用以前的透明颜色、修改getGaugeStyle check所有全路径国际化方法 删除全路径方法 统一radius 降低类型强转 替换过时方法 增加颜色自动 字符自动在子类中处理 CHART-9435 仪表盘字符大小自动处理 CHART-9435 修改国际化方法路径 CHART-9435 试管型仪表盘纵向位置优化 CHART-9435 仪表盘界面优化 CHART-9435 修改半径设置方法 CHART-9435 试管型仪表盘设计器界面修改feature/big-screen
eason
5 years ago
23 changed files with 740 additions and 332 deletions
@ -0,0 +1,38 @@
|
||||
package com.fr.design.gui.ibutton; |
||||
|
||||
import com.fr.chart.base.ChartConstants; |
||||
import com.fr.design.constants.UIConstants; |
||||
import com.fr.design.style.color.ColorControlWindow; |
||||
import com.fr.design.style.color.ColorControlWindowWithAuto; |
||||
import com.fr.general.ComparatorUtils; |
||||
|
||||
import java.awt.Color; |
||||
|
||||
public class UIColorButtonWithAuto extends UIColorButton { |
||||
|
||||
protected void checkColorChange(Color oldColor, Color newColor) { |
||||
if (ComparatorUtils.equals(oldColor, ChartConstants.AUTO_FONT_COLOR) && !ComparatorUtils.equals(newColor, ChartConstants.AUTO_FONT_COLOR)) { |
||||
setIcon(UIConstants.FONT_ICON); |
||||
} |
||||
|
||||
if (!ComparatorUtils.equals(oldColor, ChartConstants.AUTO_FONT_COLOR) && ComparatorUtils.equals(newColor, ChartConstants.AUTO_FONT_COLOR)) { |
||||
setIcon(UIConstants.AUTO_FONT_ICON); |
||||
} |
||||
|
||||
super.checkColorChange(oldColor, newColor); |
||||
} |
||||
|
||||
protected ColorControlWindow getColorControlWindow() { |
||||
if (getPopupWin() == null) { |
||||
ColorControlWindowWithAuto colorControlWindowWithAuto = new ColorControlWindowWithAuto(UIColorButtonWithAuto.this) { |
||||
protected void colorChanged() { |
||||
UIColorButtonWithAuto.this.setColor(this.getColor()); |
||||
} |
||||
}; |
||||
|
||||
setPopupWin(colorControlWindowWithAuto); |
||||
} |
||||
|
||||
return getPopupWin(); |
||||
} |
||||
} |
@ -0,0 +1,116 @@
|
||||
package com.fr.design.style.color; |
||||
|
||||
import com.fr.chart.base.ChartConstants; |
||||
import com.fr.design.border.UIRoundedBorder; |
||||
import com.fr.design.constants.UIConstants; |
||||
import com.fr.design.gui.ibutton.UIButton; |
||||
import com.fr.design.gui.ipoppane.PopupHider; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
|
||||
import javax.swing.JPanel; |
||||
import javax.swing.event.ChangeEvent; |
||||
import javax.swing.event.ChangeListener; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.Color; |
||||
import java.awt.Component; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
|
||||
public abstract class ColorControlWindowWithAuto extends ColorControlWindow { |
||||
|
||||
private ColorSelectionPopupPaneWithAuto selectionPopupPaneWithAuto; |
||||
|
||||
public ColorControlWindowWithAuto(PopupHider popupHider) { |
||||
this(false, popupHider); |
||||
} |
||||
|
||||
public ColorControlWindowWithAuto(boolean isSupportTransparent, PopupHider popupHider) { |
||||
super(isSupportTransparent, popupHider); |
||||
} |
||||
|
||||
public Color getColor() { |
||||
if (selectionPopupPaneWithAuto == null) { |
||||
return null; |
||||
} |
||||
return selectionPopupPaneWithAuto.getColor(); |
||||
} |
||||
|
||||
protected void initSelectionPopupPane(boolean isSupportTransparent) { |
||||
selectionPopupPaneWithAuto = new ColorSelectionPopupPaneWithAuto(isSupportTransparent); |
||||
this.add(selectionPopupPaneWithAuto, BorderLayout.CENTER); |
||||
} |
||||
|
||||
class ColorSelectionPopupPaneWithAuto extends NewColorSelectPane { |
||||
private static final long serialVersionUID = 7822856562329146354L; |
||||
|
||||
public ColorSelectionPopupPaneWithAuto(boolean isSupportTransparent) { |
||||
super(isSupportTransparent); |
||||
|
||||
this.addChangeListener(new ChangeListener() { |
||||
|
||||
@Override |
||||
public void stateChanged(ChangeEvent e) { |
||||
colorChanged(); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
protected void doTransparent() { |
||||
getPopupHider().hidePopupMenu(); |
||||
setColor(null); |
||||
} |
||||
|
||||
protected void doAuto() { |
||||
getPopupHider().hidePopupMenu(); |
||||
setColor(ChartConstants.AUTO_FONT_COLOR); |
||||
} |
||||
|
||||
public void customButtonPressed() { |
||||
getPopupHider().hidePopupMenu(); |
||||
super.customButtonPressed(); |
||||
} |
||||
|
||||
protected void initSelectButton(boolean isSupportTransparent) { |
||||
setSupportTransparent(isSupportTransparent); |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
this.setBorder(new UIRoundedBorder(UIConstants.TOOLBAR_BORDER_COLOR, 1, 5)); |
||||
|
||||
UIButton transparentButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_ChartF_Transparency")); |
||||
UIButton autoButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_ChartF_Auto")); |
||||
|
||||
transparentButton.addActionListener(new ActionListener() { |
||||
public void actionPerformed(ActionEvent e) { |
||||
doTransparent(); |
||||
} |
||||
}); |
||||
|
||||
autoButton.addActionListener(new ActionListener() { |
||||
public void actionPerformed(ActionEvent e) { |
||||
doAuto(); |
||||
} |
||||
}); |
||||
|
||||
if (isSupportTransparent) { |
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
double[] columnSize = {f, 0}; |
||||
double[] rowSize = {p, p}; |
||||
|
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{autoButton, null}, |
||||
new Component[]{transparentButton, null} |
||||
}; |
||||
|
||||
JPanel buttonGroup = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
||||
this.add(buttonGroup, BorderLayout.NORTH); |
||||
} else { |
||||
this.add(autoButton, BorderLayout.NORTH); |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
} |
After Width: | Height: | Size: 415 B |
@ -0,0 +1,66 @@
|
||||
package com.fr.design.mainframe.chart.gui.style; |
||||
|
||||
import com.fr.chart.base.ChartConstants; |
||||
import com.fr.design.gui.ibutton.UIColorButton; |
||||
import com.fr.design.gui.ibutton.UIColorButtonWithAuto; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.general.FRFont; |
||||
import com.fr.general.GeneralUtils; |
||||
|
||||
public class ChartTextAttrPaneWithAuto extends ChartTextAttrPane { |
||||
|
||||
private static final String AUTO = Toolkit.i18nText("Fine-Design_Basic_ChartF_Auto"); |
||||
private boolean isFontSizeAuto = false; |
||||
private boolean isColorAuto = false; |
||||
public static String[] FONT_SIZES_WITH_AUTO = new String[FONT_END - FONT_START + 2]; |
||||
static { |
||||
FONT_SIZES_WITH_AUTO[0] = AUTO; |
||||
|
||||
for (int i = 1; i < FONT_SIZES_WITH_AUTO.length; i++) { |
||||
FONT_SIZES_WITH_AUTO[i] = FONT_START + i - 1 + ""; |
||||
} |
||||
} |
||||
|
||||
public ChartTextAttrPaneWithAuto() { |
||||
super(); |
||||
} |
||||
|
||||
public ChartTextAttrPaneWithAuto(boolean isFontSizeAuto, boolean isColorAuto) { |
||||
this.isFontSizeAuto = isFontSizeAuto; |
||||
this.isColorAuto = isColorAuto; |
||||
|
||||
initState(); |
||||
initComponents(); |
||||
} |
||||
|
||||
protected void initFontColorState() { |
||||
setFontColor(isColorAuto ? new UIColorButtonWithAuto() : new UIColorButton()); |
||||
} |
||||
|
||||
protected Object[] getFontSizeComboBoxModel() { |
||||
return isFontSizeAuto ? FONT_SIZES_WITH_AUTO : FONT_SIZES; |
||||
} |
||||
|
||||
protected float updateFontSize() { |
||||
if (isFontSizeAuto && ComparatorUtils.equals(getFontSizeComboBox().getSelectedItem(), AUTO)) { |
||||
return ChartConstants.AUTO_FONT_SIZE; |
||||
} |
||||
|
||||
return Float.parseFloat(GeneralUtils.objectToString(getFontSizeComboBox().getSelectedItem())); |
||||
} |
||||
|
||||
protected void populateFontSize(FRFont frFont) { |
||||
if (getFontSizeComboBox() != null && isFontSizeAuto) { |
||||
if (frFont.getSize() == ChartConstants.AUTO_FONT_SIZE) { |
||||
getFontSizeComboBox().setSelectedItem(AUTO); |
||||
} else { |
||||
getFontSizeComboBox().setSelectedItem(frFont.getSize() + ""); |
||||
} |
||||
} |
||||
|
||||
if (getFontSizeComboBox() != null && !isFontSizeAuto) { |
||||
getFontSizeComboBox().setSelectedItem(frFont.getSize()); |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue