Browse Source

Merging in latest from upstream (PF/design:refs/heads/dev)

* commit '8d1afe6a941f06821bf7a118f0694b33f01aa375': (28 commits)
  无JIRA任务。调整代码。
  REPORT-1096 不继承UIButton
  无JIRA任务。调整代码。
  无JIRA任务。整理代码
  REPORT-1096 在“纸张背景”窗口中增加取色器按钮
  REPORT-1096 自定义界面的颜色随鼠标位置动态变化;修改取色框的UI
  REPORT-1096 完成基本功能
  无JIRA任务,给CustomChooserPanel.java 调整缩进
  REPORT-1096 将取色按钮封装为一个类
  REPORT-1096 实现第一个界面(下拉颜色选择框)里的取色器功能
  REPORT-1287 属性返回数组代码问题
  国际化
  返回空数组
  解决tab块设置自适应布局的时候->移动端->显示手机重布局的bug
  object instance
  改了一下移动端选项卡里面标题“自适应布局”和“绝对布局”统一为“手机属性”
  给设计器->属性面板->绝对布局->移动端->加上手机重布局
  1
  国际化
  calculator优化
  ...
master
rinoux 8 years ago
parent
commit
039cc56c5d
  1. 4
      designer/src/com/fr/design/actions/cell/NewPresentAction.java
  2. 7
      designer/src/com/fr/design/actions/report/ReportBackgroundAction.java
  3. 1
      designer/src/com/fr/design/actions/report/ReportParameterAction.java
  4. 2
      designer/src/com/fr/design/mainframe/WorkBookModelAdapter.java
  5. 8
      designer_base/src/com/fr/design/beans/FurtherBasicBeanPane.java
  6. 22
      designer_base/src/com/fr/design/data/datapane/preview/PreviewTableModel.java
  7. 12
      designer_base/src/com/fr/design/hyperlink/AbstractHyperlinkPane.java
  8. 14
      designer_base/src/com/fr/design/hyperlink/HyperlinkTargetFrame.java
  9. BIN
      designer_base/src/com/fr/design/images/gui/colorPicker/colorPicker16.png
  10. BIN
      designer_base/src/com/fr/design/images/gui/colorPicker/colorPicker18.png
  11. BIN
      designer_base/src/com/fr/design/images/gui/colorPicker/colorPickerFrame.png
  12. 2
      designer_base/src/com/fr/design/locale/designer.properties
  13. 3
      designer_base/src/com/fr/design/locale/designer_en_US.properties
  14. 4
      designer_base/src/com/fr/design/locale/designer_ja_JP.properties
  15. 4
      designer_base/src/com/fr/design/locale/designer_ko_KR.properties
  16. 5
      designer_base/src/com/fr/design/locale/designer_zh_CN.properties
  17. 3
      designer_base/src/com/fr/design/locale/designer_zh_TW.properties
  18. 202
      designer_base/src/com/fr/design/style/color/ColorPicker.java
  19. 6
      designer_base/src/com/fr/design/style/color/ColorSelectDialog.java
  20. 26
      designer_base/src/com/fr/design/style/color/ColorSelectPane.java
  21. 302
      designer_base/src/com/fr/design/style/color/CustomChooserPanel.java
  22. 17
      designer_base/src/com/fr/design/style/color/NewColorSelectPane.java
  23. 46
      designer_base/src/com/fr/design/style/color/PickColorButtonFactory.java
  24. 2
      designer_base/src/com/fr/env/RemoteEnv.java
  25. 8
      designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java
  26. 5
      designer_chart/src/com/fr/design/chart/fun/IndependentChartUIProvider.java
  27. 8
      designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java
  28. 2
      designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java
  29. 19
      designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypePane.java
  30. 3
      designer_form/src/com/fr/design/designer/creator/XCreator.java
  31. 5
      designer_form/src/com/fr/design/designer/creator/XElementCase.java
  32. 8
      designer_form/src/com/fr/design/designer/creator/XWAbsoluteBodyLayout.java
  33. 1
      designer_form/src/com/fr/design/designer/creator/XWFitLayout.java
  34. 11
      designer_form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java
  35. 4
      designer_form/src/com/fr/design/designer/properties/BodyAppRelayoutTable.java
  36. 5
      designer_form/src/com/fr/design/designer/properties/mobile/BodyMobilePropertyUI.java

4
designer/src/com/fr/design/actions/cell/NewPresentAction.java

@ -26,7 +26,7 @@ public class NewPresentAction extends PresentCheckBoxAction {
@Override @Override
public boolean executeActionReturnUndoRecordNeeded() { public boolean executeActionReturnUndoRecordNeeded() {
if (!ComparatorUtils.equals(this.itemName, "NOPRESENT")) { if (!ComparatorUtils.equals(this.itemName, "NOPRESENT")) {
CellElementPropertyPane.getInstance().GoToPane(Inter.getLocText("Present"), this.itemName); CellElementPropertyPane.getInstance().GoToPane(Inter.getLocText("FR-Designer_Present"), this.itemName);
} else { } else {
TemplateCellElement ce = getSelectedCellElement(); TemplateCellElement ce = getSelectedCellElement();
// 只有原来ce设置了形态的情况下才有undo操作 // 只有原来ce设置了形态的情况下才有undo操作
@ -73,7 +73,7 @@ public class NewPresentAction extends PresentCheckBoxAction {
try { try {
Class clazz = GeneralUtils.classForName(itemName); Class clazz = GeneralUtils.classForName(itemName);
if (itemName.equals(currentPresent.getClass().getName())) { if (itemName.equals(currentPresent.getClass().getName())) {
return StableUtils.classInstanceOf(currentPresent.getClass(), clazz); return StableUtils.objectInstanceOf(currentPresent, clazz);
} }
} catch (Exception e) { } catch (Exception e) {
return "NOPRESENT".equals(itemName) && currentPresent == null; return "NOPRESENT".equals(itemName) && currentPresent == null;

7
designer/src/com/fr/design/actions/report/ReportBackgroundAction.java

@ -5,6 +5,7 @@ package com.fr.design.actions.report;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.actions.ReportComponentAction; import com.fr.design.actions.ReportComponentAction;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ReportComponent; import com.fr.design.mainframe.ReportComponent;
import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.KeySetUtils;
@ -36,14 +37,16 @@ public class ReportBackgroundAction extends ReportComponentAction<ReportComponen
} }
final ReportBackgroundPane bPane = new ReportBackgroundPane(); final ReportBackgroundPane bPane = new ReportBackgroundPane();
bPane.populate(ReportUtils.getReportSettings(reportPane.getTemplateReport())); bPane.populate(ReportUtils.getReportSettings(reportPane.getTemplateReport()));
bPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { BasicDialog bDialog = bPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override @Override
public void doOk() { public void doOk() {
bPane.update(reportPane.getTemplateReport().getReportSettings()); bPane.update(reportPane.getTemplateReport().getReportSettings());
reportPane.fireTargetModified(); reportPane.fireTargetModified();
} }
}).setVisible(true); });
bDialog.setModal(false);
bDialog.setVisible(true);
return false; return false;
} }
} }

1
designer/src/com/fr/design/actions/report/ReportParameterAction.java

@ -62,6 +62,7 @@ public class ReportParameterAction extends JWorkBookAction {
jwb.fireTargetModified(); jwb.fireTargetModified();
jwb.updateReportParameterAttr(); jwb.updateReportParameterAttr();
jwb.populateReportParameterAttr(); jwb.populateReportParameterAttr();
} }
}); });
parameterArrayDialog.setVisible(true); parameterArrayDialog.setVisible(true);

2
designer/src/com/fr/design/mainframe/WorkBookModelAdapter.java

@ -52,7 +52,7 @@ public class WorkBookModelAdapter extends DesignModelAdapter<WorkBook, JWorkBook
public Parameter[] getTableDataParameters() { public Parameter[] getTableDataParameters() {
TableDataSource source = this.getBook(); TableDataSource source = this.getBook();
Calculator c = Calculator.createCalculator(); Calculator c = Calculator.createCalculator();
c.setAttribute(TableDataSource.class, source); c.setAttribute(TableDataSource.KEY, source);
java.util.List<ParameterProvider> list = new java.util.ArrayList<ParameterProvider>(); java.util.List<ParameterProvider> list = new java.util.ArrayList<ParameterProvider>();
java.util.Iterator<String> nameIt = this.getBook().getTableDataNameIterator(); java.util.Iterator<String> nameIt = this.getBook().getTableDataNameIterator();
while (nameIt.hasNext()) { while (nameIt.hasNext()) {

8
designer_base/src/com/fr/design/beans/FurtherBasicBeanPane.java

@ -1,5 +1,7 @@
package com.fr.design.beans; package com.fr.design.beans;
import com.fr.stable.StringUtils;
/** /**
* *
* @author zhou * @author zhou
@ -17,8 +19,10 @@ public abstract class FurtherBasicBeanPane<T> extends BasicBeanPane<T> {
* title应该是一个属性不只是对话框的标题时用到与其他组件结合时也会用得到 * title应该是一个属性不只是对话框的标题时用到与其他组件结合时也会用得到
* @return 绥化狂标题 * @return 绥化狂标题
*/ */
@Override @Deprecated
public abstract String title4PopupWindow(); public String title4PopupWindow(){
return StringUtils.EMPTY;
}
/** /**
* 重置 * 重置

22
designer_base/src/com/fr/design/data/datapane/preview/PreviewTableModel.java

@ -50,7 +50,7 @@ public class PreviewTableModel extends AbstractTableModel {
maxRowCount = rowCount; maxRowCount = rowCount;
} }
final int finalRowCount = maxRowCount; final int finalRowCount = maxRowCount;
DataModel dm = new DataModel() { DataModel dm = new AbstractDataModel() {
@Override @Override
public void release() throws Exception { public void release() throws Exception {
@ -100,7 +100,7 @@ public class PreviewTableModel extends AbstractTableModel {
} catch (TableDataException e) { } catch (TableDataException e) {
FRContext.getLogger().error(e.getMessage(), e); FRContext.getLogger().error(e.getMessage(), e);
DesignUtils.errorMessage(e.getMessage()); DesignUtils.errorMessage(e.getMessage());
return Inter.getLocText("Error"); return Inter.getLocText("FR-Designer_Error");
} }
} }
@ -149,7 +149,7 @@ public class PreviewTableModel extends AbstractTableModel {
} }
public String getColumnName(int column) { public String getColumnName(int column) {
return Inter.getLocText("Error"); return Inter.getLocText("FR-Designer_Error");
} }
public int getColumnCount() { public int getColumnCount() {
@ -166,7 +166,7 @@ public class PreviewTableModel extends AbstractTableModel {
private String checkType(int column) { private String checkType(int column) {
if (dateIndexs.contain(column)) { if (dateIndexs.contain(column)) {
String s = Inter.getLocText("Date"); String s = Inter.getLocText("FR-Designer_Date");
return ("(" + s + ")"); return ("(" + s + ")");
} }
@ -187,23 +187,23 @@ public class PreviewTableModel extends AbstractTableModel {
if (o == null) { if (o == null) {
s = "?"; s = "?";
} else if (o instanceof String) { } else if (o instanceof String) {
s = Inter.getLocText("Parameter-String"); s = Inter.getLocText("FR-Designer_Parameter_String");
if (FRContext.getCurrentEnv() instanceof RemoteEnv && dataModel instanceof EmbeddedTDDataModel) { if (FRContext.getCurrentEnv() instanceof RemoteEnv && dataModel instanceof EmbeddedTDDataModel) {
Class clzz = ((EmbeddedTDDataModel) dataModel).getColumnClass(column); Class clzz = ((EmbeddedTDDataModel) dataModel).getColumnClass(column);
if (Number.class.isAssignableFrom(clzz)) { if (Number.class.isAssignableFrom(clzz)) {
s = Inter.getLocText("Number");//bigdecimal s = Inter.getLocText("FR-Designer_Number");//bigdecimal
} else if (java.sql.Date.class.isAssignableFrom(clzz)) { } else if (java.sql.Date.class.isAssignableFrom(clzz)) {
s = Inter.getLocText("Date"); s = Inter.getLocText("FR-Designer_Date");
} }
} }
} else if (o instanceof Integer) { } else if (o instanceof Integer) {
s = Inter.getLocText("Integer"); s = Inter.getLocText("FR-Designer_Integer");
} else if (o instanceof Double || o instanceof Float) { } else if (o instanceof Double || o instanceof Float) {
s = Inter.getLocText("Double"); s = Inter.getLocText("FR-Designer_Double");
} else if (o instanceof java.sql.Date || o instanceof java.util.Date) { } else if (o instanceof java.sql.Date || o instanceof java.util.Date) {
s = Inter.getLocText("Date"); s = Inter.getLocText("FR-Designer_Date");
} else if (o instanceof Number) { } else if (o instanceof Number) {
s = Inter.getLocText("Number");//bigdecimal s = Inter.getLocText("FR-Designer_Number");//bigdecimal
} else { } else {
s = "?"; s = "?";
} }

12
designer_base/src/com/fr/design/hyperlink/AbstractHyperlinkPane.java

@ -115,17 +115,7 @@ public abstract class AbstractHyperlinkPane<T extends Hyperlink> extends BasicBe
@Override @Override
public void populateBean(T link) { public void populateBean(T link) {
String name = link.getTargetFrame(); String name = link.getTargetFrame();
if ("_self".equals(name)) { targetFrameComboBox.setSelectedIndex(HyperlinkTargetFrame.convert(name));
targetFrameComboBox.setSelectedIndex(SELF);
} else if ("_dialog".equals(name)) {
targetFrameComboBox.setSelectedIndex(DIALOG);
} else if ("_blank".equals(name)) {
targetFrameComboBox.setSelectedIndex(NEW_WINDOW);
} else {
DefaultComboBoxModel model = (DefaultComboBoxModel) targetFrameComboBox.getModel();
model.addElement(name);
targetFrameComboBox.setSelectedItem(name);
}
heightTextFiled.setText(String.valueOf(link.getHeight() == 0 ? DEFAULT_H_VALUE : link.getHeight())); heightTextFiled.setText(String.valueOf(link.getHeight() == 0 ? DEFAULT_H_VALUE : link.getHeight()));
widthTextFiled.setText(String.valueOf(link.getWidth() == 0 ? DEFAULT_V_VALUE : link.getWidth())); widthTextFiled.setText(String.valueOf(link.getWidth() == 0 ? DEFAULT_V_VALUE : link.getWidth()));
populateSubHyperlinkBean(link); populateSubHyperlinkBean(link);

14
designer_base/src/com/fr/design/hyperlink/HyperlinkTargetFrame.java

@ -1,5 +1,7 @@
package com.fr.design.hyperlink; package com.fr.design.hyperlink;
import com.fr.general.ComparatorUtils;
/** /**
* Created by ibm on 2016/10/13. * Created by ibm on 2016/10/13.
*/ */
@ -27,6 +29,18 @@ public enum HyperlinkTargetFrame {
return BLANK_FRAME; return BLANK_FRAME;
} }
public static int convert(String name) {
if (arrayOfValues == null) {
arrayOfValues = HyperlinkTargetFrame.values();
}
for (HyperlinkTargetFrame hyperlinkTargetFrame : HyperlinkTargetFrame.values()) {
if (ComparatorUtils.equals(hyperlinkTargetFrame.getName(), name)) {
return hyperlinkTargetFrame.getIndex();
}
}
return BLANK_FRAME.getIndex();
}
public int getIndex() { public int getIndex() {
return index; return index;

BIN
designer_base/src/com/fr/design/images/gui/colorPicker/colorPicker16.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 332 B

BIN
designer_base/src/com/fr/design/images/gui/colorPicker/colorPicker18.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 432 B

BIN
designer_base/src/com/fr/design/images/gui/colorPicker/colorPickerFrame.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

2
designer_base/src/com/fr/design/locale/designer.properties

@ -491,3 +491,5 @@ FR-Designer_Export_failed=Export failed
FR-Designer_Exported_successfully=Exported successfully FR-Designer_Exported_successfully=Exported successfully
FR-Designer_Exporting=Exporting FR-Designer_Exporting=Exporting
FR-Designer_Export-PDF=PDF FR-Designer_Export-PDF=PDF
FR-Designer_Button_OK=OK
FR-Designer_Button_Cancel=Cancel

3
designer_base/src/com/fr/design/locale/designer_en_US.properties

@ -490,3 +490,6 @@ FR-Designer_Export_failed=Export failed
FR-Designer_Exported_successfully=Exported successfully FR-Designer_Exported_successfully=Exported successfully
FR-Designer_Exporting=Exporting FR-Designer_Exporting=Exporting
FR-Designer_Export-PDF=PDF FR-Designer_Export-PDF=PDF
FR-Designer_Properties_Mobile=MobileProperties
FR-Designer_Button_OK=OK
FR-Designer_Button_Cancel=Cancel

4
designer_base/src/com/fr/design/locale/designer_ja_JP.properties

@ -469,4 +469,6 @@ FR-Designer_Properties=FR-Designer_Properties=\
FR-Designer_Export_failed=\u5C0E\u51FA\u306B\u5931\u6557\u3057\u307E\u3057\u305F FR-Designer_Export_failed=\u5C0E\u51FA\u306B\u5931\u6557\u3057\u307E\u3057\u305F
FR-Designer_Exported_successfully=\u5C0E\u51FA\u6210\u529F FR-Designer_Exported_successfully=\u5C0E\u51FA\u6210\u529F
FR-Designer_Exporting=\u5C0E\u51FA\u3057\u3066\u3044\u307E\u3059 FR-Designer_Exporting=\u5C0E\u51FA\u3057\u3066\u3044\u307E\u3059
FR-Designer_Export-PDF=PDF\u30D5\u30A9\u30FC\u30DE\u30C3\u30C8 FR-Designer_Export-PDF=PDF\u30D5\u30A9\u30FC\u30DE\u30C3\u30C8FR-Designer_Button_OK=FR-Designer_Button_OK=\u78BA\u5B9A
FR-Designer_Button_Cancel=\u30AD\u30E3\u30F3\u30BB\u30EB
\

4
designer_base/src/com/fr/design/locale/designer_ko_KR.properties

@ -464,4 +464,6 @@ FR-Designer_Properties=\uFFFD
FR-Designer_Export_failed=\uB0B4\uBCF4\uB0B4\uAE30\uC2E4\uD328 FR-Designer_Export_failed=\uB0B4\uBCF4\uB0B4\uAE30\uC2E4\uD328
FR-Designer_Exported_successfully=\uB0B4\uBCF4\uB0B4\uAE30\uC131\uACF5 FR-Designer_Exported_successfully=\uB0B4\uBCF4\uB0B4\uAE30\uC131\uACF5
FR-Designer_Exporting=\uB0B4\uBCF4\uB0B4\uAE30\uC911 FR-Designer_Exporting=\uB0B4\uBCF4\uB0B4\uAE30\uC911
FR-Designer_Export-PDF=PDF\uC11C\uC2DD FR-Designer_Export-PDF=PDF\uC11C\uC2DDFR-Designer_Properties=\uFFFD
FR-Designer_Button_OK=\uD655\uC778FR-Designer_Button_Cancel=\uCDE8\uC18C
\

5
designer_base/src/com/fr/design/locale/designer_zh_CN.properties

@ -422,7 +422,7 @@ FR-Designer-Website_Url=http\://www.finereport.com/
FR-Designer-BBSLogin_Download-Unlogin-Tip=\u767B\u5F55\u540E\u624D\u80FD\u4E0B\u8F7D FR-Designer-BBSLogin_Download-Unlogin-Tip=\u767B\u5F55\u540E\u624D\u80FD\u4E0B\u8F7D
FR-Designer-App_ReLayout=\u624B\u673A\u91CD\u5E03\u5C40 FR-Designer-App_ReLayout=\u624B\u673A\u91CD\u5E03\u5C40
FR-Designer_Mobile-Attr=\u79FB\u52A8\u7AEF\u5C5E\u6027 FR-Designer_Mobile-Attr=\u79FB\u52A8\u7AEF\u5C5E\u6027
FR-Designer_Mobile-Vertical=\u7AD6\u5C4F FR-Designer_Mobile-Vertical=\u7AD6\u5C4FF
FR-Designer_Mobile-Horizontal=\u6A2A\u5C4F FR-Designer_Mobile-Horizontal=\u6A2A\u5C4F
FR-Designer_COMMUNITY=\u793E\u533A FR-Designer_COMMUNITY=\u793E\u533A
FR-Designer_COMMUNITY_BBS=\u5E06\u8F6F\u8BBA\u575B FR-Designer_COMMUNITY_BBS=\u5E06\u8F6F\u8BBA\u575B
@ -494,3 +494,6 @@ FR-Designer_Export_failed=\u5BFC\u51FA\u5931\u8D25
FR-Designer_Exported_successfully=\u5BFC\u51FA\u6210\u529F FR-Designer_Exported_successfully=\u5BFC\u51FA\u6210\u529F
FR-Designer_Exporting=\u6B63\u5728\u5BFC\u51FA FR-Designer_Exporting=\u6B63\u5728\u5BFC\u51FA
FR-Designer_Export-PDF=PDF\u683C\u5F0F FR-Designer_Export-PDF=PDF\u683C\u5F0F
FR-Designer_Properties_Mobile=\u624B\u673A\u5C5E\u6027
FR-Designer_Button_OK=\u786E\u5B9A
FR-Designer_Button_Cancel=\u53D6\u6D88

3
designer_base/src/com/fr/design/locale/designer_zh_TW.properties

@ -482,3 +482,6 @@ FR-Designer_Export_failed=\u532F\u51FA\u5931\u6557
FR-Designer_Exported_successfully=\u532F\u51FA\u6210\u529F FR-Designer_Exported_successfully=\u532F\u51FA\u6210\u529F
FR-Designer_Exporting=\u6B63\u5728\u532F\u51FA... FR-Designer_Exporting=\u6B63\u5728\u532F\u51FA...
FR-Designer_Export-PDF=PDF\u683C\u5F0F FR-Designer_Export-PDF=PDF\u683C\u5F0F
FR-Designer_Properties_Mobile=\u624B\u6A5F\u5C6C\u6027
FR-Designer_Button_OK=\u78BA\u5B9A
FR-Designer_Button_Cancel=\u53D6\u6D88

202
designer_base/src/com/fr/design/style/color/ColorPicker.java

@ -0,0 +1,202 @@
package com.fr.design.style.color;
/**
* Created by plough on 2016/12/22.
*/
import com.fr.base.BaseUtils;
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.Ellipse2D;
import java.awt.image.BufferedImage;
import javax.swing.*;
/**
* 取色框
*/
public class ColorPicker extends JDialog implements ActionListener
{
private Container container = getContentPane(); // 主容器
private int setCoordinateX; // 取色框x坐标
private int setCoordinateY; // 取色框y坐标
private int colorPickerSize = 190; // 取色框尺寸
private int scaleFactor = 16; // 放大倍数
private ColorPickerPanel colorPickerPanel = new ColorPickerPanel(scaleFactor); // 取色框内容面板
private Timer timer; // 用于定时重绘
private int FPS = 45; // 重绘取色器的频率
private int timeCycle = 1000 / FPS; // 时钟周期
private ColorSelectable colorSelectable;
private Point mousePos; // 鼠标的绝对坐标
private Color colorToSet; // 暂存要设置的颜色值
private Boolean setColorRealTime; // 实时设定颜色值
/**
* 构造函数创建一个取色框窗体
*/
public ColorPicker(ColorSelectable colorSelectable, Boolean setColorRealTime)
{
setUndecorated(true); // 去掉窗体边缘
setResizable(false);
Shape shape = new Ellipse2D.Double(0, 0, colorPickerSize, colorPickerSize);
setShape(shape);
container.add(colorPickerPanel);
addMouseListener(new MouseFunctions());
updateSize(colorPickerSize);
this.colorSelectable = colorSelectable;
this.setColorRealTime = setColorRealTime;
this.setAlwaysOnTop(true);
this.setVisible(true);
this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
}
public void start() {
timer = new Timer(timeCycle, this);
timer.start();
hideCursor();
// System.out.println(KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusedWindow());
}
/**
* 执行Timer要执行的部分
*/
@Override
public void actionPerformed(ActionEvent e) {
updateLocation();
colorToSet = colorPickerPanel.getPixelColor(mousePos);
if (setColorRealTime && !colorSelectable.getColor().equals(colorToSet)) {
colorSelectable.setColor(colorToSet);
}
}
public void updateLocation() {
mousePos = MouseInfo.getPointerInfo().getLocation();
setCoordinateX = mousePos.x - getSize().width/2;
setCoordinateY = mousePos.y- getSize().height/2;
colorPickerPanel.setMagnifierLocation(setCoordinateX,
setCoordinateY);
setLocation(setCoordinateX, setCoordinateY);
}
/**
* 更新窗体
*
* @param colorPickerSize 取色框尺寸
*/
public void updateSize(int colorPickerSize)
{
colorPickerPanel.setColorPickerSize(colorPickerSize);
setSize(colorPickerSize, colorPickerSize);
validate(); // 更新所有子控件
}
public void pickComplete() {
timer.stop();
colorSelectable.setColor(colorToSet);
this.dispose();
}
// 隐藏鼠标光标
public void hideCursor() {
Image imageCursor = Toolkit.getDefaultToolkit().getImage("");
Cursor cu = Toolkit.getDefaultToolkit().createCustomCursor(imageCursor, new Point(0,0), "cursor");
setCursor(cu);
}
private class MouseFunctions extends MouseAdapter
{
public void mousePressed(MouseEvent e)
{
pickComplete();
}
}
}
class ColorPickerPanel extends JPanel
{
private BufferedImage screenImage;
private Image colorPickerFrame; // 取色框的边框图案
private int colorPickerSize; // 取色框尺寸
private int locationX; // 取色框 x 坐标
private int locationY; // 取色框 y 坐标
private int scaleFactor; // 放大倍数
private Robot robot;
// getPixelColor 常数
private static int SHIFT_STEP = 8; // 比特位右移步长
private static int AND_R = 0xff0000;
private static int AND_G = 0xff00;
private static int AND_B = 0xff;
/**
* 带参数的构造函数
* @param scaleFactor 放大倍数
*/
public ColorPickerPanel(int scaleFactor)
{
try
{
robot = new Robot();
}
catch (AWTException e)
{
}
// 截屏幕
screenImage = robot.createScreenCapture(new Rectangle(0, 0, Toolkit
.getDefaultToolkit().getScreenSize().width, Toolkit
.getDefaultToolkit().getScreenSize().height));
colorPickerFrame = BaseUtils.readImage("/com/fr/design/images/gui/colorPicker/colorPickerFrame.png");
this.scaleFactor = scaleFactor;
}
/**
* 设置取色框的位置
* @param locationX x坐标
* @param locationY y坐标
*/
public void setMagnifierLocation(int locationX, int locationY)
{
this.locationX = locationX;
this.locationY = locationY;
repaint(); // 注意重画控件
}
public Color getPixelColor(Point mousePos) {
int rgb = screenImage.getRGB(mousePos.x, mousePos.y);
int R = (rgb & AND_R) >> SHIFT_STEP * 2;
int G = (rgb & AND_G) >> SHIFT_STEP;
int B = (rgb & AND_B);
return new Color(R, G, B);
}
public void setColorPickerSize(int colorPickerSize)
{
this.colorPickerSize = colorPickerSize;
}
public void paintComponent(Graphics g)
{
Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
double pixelCount = (double)colorPickerSize / scaleFactor; // 取色器一条边上的放大后的像素点个数(可以是小数)
// 关键处理代码
g2d.drawImage(
screenImage, // 要画的图片
0, // 目标矩形的第一个角的x坐标
0, // 目标矩形的第一个角的y坐标
colorPickerSize, // 目标矩形的第二个角的x坐标
colorPickerSize, // 目标矩形的第二个角的y坐标
locationX + (int)((colorPickerSize - pixelCount) * 0.5) + 1, // 源矩形的第一个角的x坐标
locationY + (int)((colorPickerSize - pixelCount) * 0.5) + 1, // 源矩形的第一个角的y坐标
locationX + (int)((colorPickerSize + pixelCount) * 0.5) + 1, // 源矩形的第二个角的x坐标
locationY + (int)((colorPickerSize + pixelCount) * 0.5) + 1, // 源矩形的第二个角的y坐标
this
);
g2d.drawImage(colorPickerFrame, 0, 0, this);
}
}

6
designer_base/src/com/fr/design/style/color/ColorSelectDialog.java

@ -91,8 +91,8 @@ public class ColorSelectDialog extends MiddleChartDialog{
this.add(buttonPane, BorderLayout.SOUTH); this.add(buttonPane, BorderLayout.SOUTH);
ok = new UIButton(Inter.getLocText("OK")); ok = new UIButton(Inter.getLocText("FR-Designer_Button_OK"));
cancel = new UIButton(Inter.getLocText("Cancel")); cancel = new UIButton(Inter.getLocText("FR-Designer_Button_Cancel"));
buttonPane.add(ok); buttonPane.add(ok);
buttonPane.add(cancel); buttonPane.add(cancel);
@ -137,7 +137,7 @@ public class ColorSelectDialog extends MiddleChartDialog{
public static void showDialog(Frame owner,ColorSelectDetailPane pane,Color initialColor,ColorSelectable selectePane){ public static void showDialog(Frame owner,ColorSelectDetailPane pane,Color initialColor,ColorSelectable selectePane){
ColorTracker okListener = new ColorTracker(pane); ColorTracker okListener = new ColorTracker(pane);
ColorSelectDialog dialog = new ColorSelectDialog(owner,pane,initialColor,okListener,selectePane); ColorSelectDialog dialog = new ColorSelectDialog(owner,pane,initialColor,okListener,selectePane);
dialog.setModal(true); // dialog.setModal(true);
dialog.show(); dialog.show();
} }

26
designer_base/src/com/fr/design/style/color/ColorSelectPane.java

@ -3,10 +3,7 @@
*/ */
package com.fr.design.style.color; package com.fr.design.style.color;
import java.awt.BorderLayout; import java.awt.*;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.GridLayout;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
@ -72,9 +69,7 @@ public class ColorSelectPane extends TransparentPane implements ColorSelectable
JPanel centerPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); JPanel centerPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane();
this.add(centerPane, BorderLayout.CENTER); this.add(centerPane, BorderLayout.CENTER);
// 最近使用 centerPane.add(getRow1Pane());
UsedColorPane pane = new UsedColorPane(1, 8, ColorSelectConfigManager.getInstance().getColors(),this);
centerPane.add(pane.getPane());
JPanel menuColorPane1 = new JPanel(); JPanel menuColorPane1 = new JPanel();
centerPane.add(menuColorPane1); centerPane.add(menuColorPane1);
@ -104,6 +99,23 @@ public class ColorSelectPane extends TransparentPane implements ColorSelectable
centerPane.add(centerPane1); centerPane.add(centerPane1);
} }
// 第一行,1个取色按钮 + 7个最近使用的颜色
private JPanel getRow1Pane() {
JPanel row1Pane = new JPanel(FRGUIPaneFactory.createBorderLayout());
row1Pane.setBorder(BorderFactory.createEmptyBorder(8, 8, 0, 0));
row1Pane.setPreferredSize(new Dimension(135, 24)); // 宽度为 16 * 8 + 7
// 取色按钮
UIButton pickColorButton = PickColorButtonFactory.getPickColorButton(this, PickColorButtonFactory.IconType.ICON16, true);
row1Pane.add(pickColorButton, BorderLayout.WEST);
// 最近使用
UsedColorPane usedColorPane = new UsedColorPane(1, 7, ColorSelectConfigManager.getInstance().getColors(),this);
usedColorPane.getPane().setBorder(BorderFactory.createEmptyBorder(0, 1, 0, 8));
row1Pane.add(usedColorPane.getPane());
return row1Pane;
}
protected Color[] getColorArray(){ protected Color[] getColorArray(){
return ColorFactory.MenuColors; return ColorFactory.MenuColors;
} }

302
designer_base/src/com/fr/design/style/color/CustomChooserPanel.java

@ -10,9 +10,7 @@ import java.awt.Graphics;
import java.awt.GridLayout; import java.awt.GridLayout;
import java.awt.Image; import java.awt.Image;
import java.awt.Point; import java.awt.Point;
import java.awt.event.MouseAdapter; import java.awt.event.*;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;
import java.awt.image.MemoryImageSource; import java.awt.image.MemoryImageSource;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -21,7 +19,6 @@ import javax.swing.ButtonGroup;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JColorChooser; import javax.swing.JColorChooser;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JSlider;
import javax.swing.SpinnerNumberModel; import javax.swing.SpinnerNumberModel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.colorchooser.AbstractColorChooserPanel; import javax.swing.colorchooser.AbstractColorChooserPanel;
@ -32,6 +29,7 @@ import javax.swing.event.DocumentListener;
import javax.swing.text.BadLocationException; import javax.swing.text.BadLocationException;
import javax.swing.text.Document; import javax.swing.text.Document;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.islider.UISlider; import com.fr.design.gui.islider.UISlider;
@ -42,72 +40,113 @@ import com.fr.general.Inter;
/** /**
* 颜色选择器自定义面板 * 颜色选择器自定义面板
* @author focus
* *
* @author focus
*/
class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelectable {
/**
* The gradient image displayed.
*/ */
class CustomChooserPanel extends AbstractColorChooserPanel
{
/** The gradient image displayed. */
private transient Image gradientImage; private transient Image gradientImage;
/** The Panel that holds the gradient image. */ /**
* The Panel that holds the gradient image.
*/
private transient JPanel gradientPanel; private transient JPanel gradientPanel;
/** The track gradient image. */ /**
* The track gradient image.
*/
private transient Image trackImage; private transient Image trackImage;
/** The panel that holds the track. */ /**
* The panel that holds the track.
*/
private transient JPanel trackPanel; private transient JPanel trackPanel;
/** The slider for the locked HSB value. */ /**
* The slider for the locked HSB value.
*/
private transient UISlider slider; private transient UISlider slider;
/** The RadioButton that controls the Hue. */ /**
* The RadioButton that controls the Hue.
*/
private transient UIRadioButton hRadio; private transient UIRadioButton hRadio;
/** The RadioButton that controls the Saturation. */ /**
* The RadioButton that controls the Saturation.
*/
private transient UIRadioButton sRadio; private transient UIRadioButton sRadio;
/** The RadioButton that controls the Brightness. */ /**
* The RadioButton that controls the Brightness.
*/
private transient UIRadioButton bRadio; private transient UIRadioButton bRadio;
/** The UIBasicSpinner that controls the Hue. */ /**
* The UIBasicSpinner that controls the Hue.
*/
private transient UIBasicSpinner hSpinner; private transient UIBasicSpinner hSpinner;
/** The UIBasicSpinner that controls the Saturation. */ /**
* The UIBasicSpinner that controls the Saturation.
*/
private transient UIBasicSpinner sSpinner; private transient UIBasicSpinner sSpinner;
/** The UIBasicSpinner that controls the Brightness. */ /**
* The UIBasicSpinner that controls the Brightness.
*/
private transient UIBasicSpinner bSpinner; private transient UIBasicSpinner bSpinner;
/** The UIBasicSpinner that controls the Red. */ /**
* The UIBasicSpinner that controls the Red.
*/
private transient UIBasicSpinner rSpinner; private transient UIBasicSpinner rSpinner;
/** The UIBasicSpinner that controls the Green. */ /**
* The UIBasicSpinner that controls the Green.
*/
private transient UIBasicSpinner gSpinner; private transient UIBasicSpinner gSpinner;
/** The UIBasicSpinner that controls the Blue. */ /**
* The UIBasicSpinner that controls the Blue.
*/
private transient UIBasicSpinner bbSpinner; private transient UIBasicSpinner bbSpinner;
private transient UITextField field; private transient UITextField field;
// private transient PickColorButton pickColorButton;
/** The default width of the gradient image. */ /**
* The default width of the gradient image.
*/
private static final int IMG_WIDTH = 200; private static final int IMG_WIDTH = 200;
/** The default height of the gradient image. */ /**
* The default height of the gradient image.
*/
private static final int IMG_HEIGHT = 205; private static final int IMG_HEIGHT = 205;
/** The default width of the track gradient. */ /**
* The default width of the track gradient.
*/
private static final int TRACK_WIDTH = 20; private static final int TRACK_WIDTH = 20;
/** The UILabel for Red. */ /**
* The UILabel for Red.
*/
private static final UILabel R = new UILabel("R"); private static final UILabel R = new UILabel("R");
/** The UILabel for Green. */ /**
* The UILabel for Green.
*/
private static final UILabel G = new UILabel("G"); private static final UILabel G = new UILabel("G");
/** The UILabel for Blue. */ /**
* The UILabel for Blue.
*/
private static final UILabel B = new UILabel("B"); private static final UILabel B = new UILabel("B");
private static final int H_MAX = 365; private static final int H_MAX = 365;
@ -131,7 +170,9 @@ class CustomChooserPanel extends AbstractColorChooserPanel
private ImageRGBScrollListener rgbScroll = new ImageRGBScrollListener(); private ImageRGBScrollListener rgbScroll = new ImageRGBScrollListener();
/** The point that is displayed in the gradient image. */ /**
* The point that is displayed in the gradient image.
*/
private transient Point gradientPoint = new Point(); private transient Point gradientPoint = new Point();
/** /**
@ -140,19 +181,29 @@ class CustomChooserPanel extends AbstractColorChooserPanel
*/ */
private transient boolean internalChange = false; private transient boolean internalChange = false;
/** This indicates that the change to the spinner is triggered internally. */ /**
* This indicates that the change to the spinner is triggered internally.
*/
private transient boolean spinnerTrigger = false; private transient boolean spinnerTrigger = false;
/** This int identifies which spinner is currently locked. */ /**
* This int identifies which spinner is currently locked.
*/
private transient int locked = -1; private transient int locked = -1;
/** This value indicates that the Hue spinner is locked. */ /**
* This value indicates that the Hue spinner is locked.
*/
static final int HLOCKED = 0; static final int HLOCKED = 0;
/** This value indicates that the Saturation spinner is locked. */ /**
* This value indicates that the Saturation spinner is locked.
*/
static final int SLOCKED = 1; static final int SLOCKED = 1;
/** This value indicates that the Brightness spinner is locked. */ /**
* This value indicates that the Brightness spinner is locked.
*/
static final int BLOCKED = 2; static final int BLOCKED = 2;
/** /**
@ -168,6 +219,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel
private static final String HEX_PATTERN = "([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$"; private static final String HEX_PATTERN = "([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$";
private Pattern pattern; private Pattern pattern;
private Matcher matcher; private Matcher matcher;
@Override @Override
public void insertUpdate(DocumentEvent e) { public void insertUpdate(DocumentEvent e) {
Document doc = e.getDocument(); Document doc = e.getDocument();
@ -205,16 +257,14 @@ class CustomChooserPanel extends AbstractColorChooserPanel
* This helper class handles mouse events on the gradient image. * This helper class handles mouse events on the gradient image.
*/ */
class MainGradientMouseListener extends MouseAdapter class MainGradientMouseListener extends MouseAdapter
implements MouseMotionListener implements MouseMotionListener {
{
/** /**
* This method is called when the mouse is pressed over the gradient * This method is called when the mouse is pressed over the gradient
* image. The JColorChooser is then updated with new HSB values. * image. The JColorChooser is then updated with new HSB values.
* *
* @param e The MouseEvent. * @param e The MouseEvent.
*/ */
public void mousePressed(MouseEvent e) public void mousePressed(MouseEvent e) {
{
gradientPoint = e.getPoint(); gradientPoint = e.getPoint();
update(e.getPoint()); update(e.getPoint());
} }
@ -225,8 +275,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel
* *
* @param e The MouseEvent. * @param e The MouseEvent.
*/ */
public void mouseDragged(MouseEvent e) public void mouseDragged(MouseEvent e) {
{
Point p = e.getPoint(); Point p = e.getPoint();
if (isMouseOutOfImage(p)) { if (isMouseOutOfImage(p)) {
return; return;
@ -245,8 +294,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel
* *
* @param e The MouseEvent. * @param e The MouseEvent.
*/ */
public void mouseMoved(MouseEvent e) public void mouseMoved(MouseEvent e) {
{
// Do nothing. // Do nothing.
} }
@ -255,8 +303,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel
* *
* @param p The Point where the MouseEvent occurred. * @param p The Point where the MouseEvent occurred.
*/ */
private void update(Point p) private void update(Point p) {
{
handlingMouse = true; handlingMouse = true;
if (hSpinner.isEnabled()) { if (hSpinner.isEnabled()) {
updateH(p); updateH(p);
@ -273,8 +320,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel
* *
* @param p The point where the MouseEvent occurred. * @param p The point where the MouseEvent occurred.
*/ */
private void updateH(Point p) private void updateH(Point p) {
{
float s = (IMG_WIDTH - p.x * 1f) / IMG_WIDTH; float s = (IMG_WIDTH - p.x * 1f) / IMG_WIDTH;
float b = (IMG_HEIGHT - p.y * 1f) / IMG_HEIGHT; float b = (IMG_HEIGHT - p.y * 1f) / IMG_HEIGHT;
@ -292,8 +338,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel
* *
* @param p The point where the MouseEvent occurred. * @param p The point where the MouseEvent occurred.
*/ */
private void updateS(Point p) private void updateS(Point p) {
{
float h = p.x * 1f / IMG_WIDTH; float h = p.x * 1f / IMG_WIDTH;
float b = (IMG_HEIGHT - p.y * 1f) / IMG_HEIGHT; float b = (IMG_HEIGHT - p.y * 1f) / IMG_HEIGHT;
@ -310,8 +355,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel
* *
* @param p The point where the MouseEvent occurred. * @param p The point where the MouseEvent occurred.
*/ */
private void updateB(Point p) private void updateB(Point p) {
{
float h = p.x * 1f / IMG_WIDTH; float h = p.x * 1f / IMG_WIDTH;
float s = (IMG_HEIGHT - p.y * 1f) / IMG_HEIGHT; float s = (IMG_HEIGHT - p.y * 1f) / IMG_HEIGHT;
@ -327,16 +371,14 @@ class CustomChooserPanel extends AbstractColorChooserPanel
/** /**
* This method listens for slider value changes. * This method listens for slider value changes.
*/ */
class SliderChangeListener implements ChangeListener class SliderChangeListener implements ChangeListener {
{
/** /**
* This method is called when the slider value changes. It should change * This method is called when the slider value changes. It should change
* the color of the JColorChooser. * the color of the JColorChooser.
* *
* @param e The ChangeEvent. * @param e The ChangeEvent.
*/ */
public void stateChanged(ChangeEvent e) public void stateChanged(ChangeEvent e) {
{
if (internalChange) { if (internalChange) {
return; return;
} }
@ -344,8 +386,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel
Integer value = new Integer(slider.getValue()); Integer value = new Integer(slider.getValue());
switch (locked) switch (locked) {
{
case HLOCKED: case HLOCKED:
hSpinner.setValue(value); hSpinner.setValue(value);
break; break;
@ -364,29 +405,22 @@ class CustomChooserPanel extends AbstractColorChooserPanel
* This helper class determines the active UIBasicSpinner. * This helper class determines the active UIBasicSpinner.
*/ */
class RadioStateListener extends MouseAdapter class RadioStateListener extends MouseAdapter
implements MouseMotionListener implements MouseMotionListener {
{
/** /**
* This method is called when there is a new UIRadioButton that was * This method is called when there is a new UIRadioButton that was
* selected. As a result, it should activate the associated UIBasicSpinner. * selected. As a result, it should activate the associated UIBasicSpinner.
* *
* @param e The ChangeEvent. * @param e The ChangeEvent.
*/ */
public void mousePressed(MouseEvent e) public void mousePressed(MouseEvent e) {
{
UIBasicSpinner change; UIBasicSpinner change;
if (e.getSource() == hRadio) if (e.getSource() == hRadio) {
{
locked = HLOCKED; locked = HLOCKED;
change = hSpinner; change = hSpinner;
} } else if (e.getSource() == sRadio) {
else if (e.getSource() == sRadio)
{
locked = SLOCKED; locked = SLOCKED;
change = sSpinner; change = sSpinner;
} } else {
else
{
locked = BLOCKED; locked = BLOCKED;
change = bSpinner; change = bSpinner;
} }
@ -406,16 +440,14 @@ class CustomChooserPanel extends AbstractColorChooserPanel
/** /**
* hsl 监听 * hsl 监听
*/ */
class ImageScrollListener implements ChangeListener class ImageScrollListener implements ChangeListener {
{
/** /**
* This method is called whenever one of the UIBasicSpinner values change. The * This method is called whenever one of the UIBasicSpinner values change. The
* JColorChooser should be updated with the new HSB values. * JColorChooser should be updated with the new HSB values.
* *
* @param e The ChangeEvent. * @param e The ChangeEvent.
*/ */
public void stateChanged(ChangeEvent e) public void stateChanged(ChangeEvent e) {
{
if (internalChange) { if (internalChange) {
return; return;
} }
@ -427,16 +459,14 @@ class CustomChooserPanel extends AbstractColorChooserPanel
/** /**
* rgb 监听 * rgb 监听
*/ */
class ImageRGBScrollListener implements ChangeListener class ImageRGBScrollListener implements ChangeListener {
{
/** /**
* This method is called whenever one of the UIBasicSpinner values change. The * This method is called whenever one of the UIBasicSpinner values change. The
* JColorChooser should be updated with the new HSB values. * JColorChooser should be updated with the new HSB values.
* *
* @param e The ChangeEvent. * @param e The ChangeEvent.
*/ */
public void stateChanged(ChangeEvent e) public void stateChanged(ChangeEvent e) {
{
if (internalChange) { if (internalChange) {
return; return;
} }
@ -458,8 +488,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel
/** /**
* Creates a new DefaultHSBChooserPanel object. * Creates a new DefaultHSBChooserPanel object.
*/ */
CustomChooserPanel() CustomChooserPanel() {
{
super(); super();
} }
@ -469,8 +498,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel
* *
* @return The name displayed in the JColorChooser tab. * @return The name displayed in the JColorChooser tab.
*/ */
public String getDisplayName() public String getDisplayName() {
{
return Inter.getLocText("FR-Designer_Custom"); return Inter.getLocText("FR-Designer_Custom");
} }
@ -479,8 +507,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel
* UIBasicSpinners, the JSlider, and the gradient image point) with updated * UIBasicSpinners, the JSlider, and the gradient image point) with updated
* values when the JColorChooser color value changes. * values when the JColorChooser color value changes.
*/ */
public void updateChooser() public void updateChooser() {
{
Color c = getColorSelectionModel().getSelectedColor(); Color c = getColorSelectionModel().getSelectedColor();
float[] hsbVals = Color.RGBtoHSB(c.getRed(), c.getGreen(), c.getBlue(), float[] hsbVals = Color.RGBtoHSB(c.getRed(), c.getGreen(), c.getBlue(),
null); null);
@ -502,20 +529,17 @@ class CustomChooserPanel extends AbstractColorChooserPanel
} }
private void adjustHSLValue(float[] hsbVals) { private void adjustHSLValue(float[] hsbVals) {
if (! spinnerTrigger) if (!spinnerTrigger) {
{
hSpinner.setValue(new Integer((int) (hsbVals[0] * HSPINNER_VALUE))); hSpinner.setValue(new Integer((int) (hsbVals[0] * HSPINNER_VALUE)));
sSpinner.setValue(new Integer((int) (hsbVals[1] * SSPINNER_VALUE))); sSpinner.setValue(new Integer((int) (hsbVals[1] * SSPINNER_VALUE)));
bSpinner.setValue(new Integer((int) (hsbVals[2] * LSPINNER_VALUE))); bSpinner.setValue(new Integer((int) (hsbVals[2] * LSPINNER_VALUE)));
} }
switch (locked) switch (locked) {
{
case HLOCKED: case HLOCKED:
if (slider != null) { if (slider != null) {
slider.setValue(((Number) hSpinner.getValue()).intValue()); slider.setValue(((Number) hSpinner.getValue()).intValue());
} }
if (! handlingMouse) if (!handlingMouse) {
{
gradientPoint.x = (int) ((1 gradientPoint.x = (int) ((1
- ((Number) sSpinner.getValue()).intValue() / SSPINNER_VALUE) * IMG_WIDTH); - ((Number) sSpinner.getValue()).intValue() / SSPINNER_VALUE) * IMG_WIDTH);
gradientPoint.y = (int) ((1 gradientPoint.y = (int) ((1
@ -526,8 +550,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel
if (slider != null) { if (slider != null) {
slider.setValue(((Number) sSpinner.getValue()).intValue()); slider.setValue(((Number) sSpinner.getValue()).intValue());
} }
if (! handlingMouse) if (!handlingMouse) {
{
gradientPoint.x = (int) (((Number) hSpinner.getValue()).intValue() / HSPINNER_VALUE * IMG_WIDTH); gradientPoint.x = (int) (((Number) hSpinner.getValue()).intValue() / HSPINNER_VALUE * IMG_WIDTH);
gradientPoint.y = (int) ((1 gradientPoint.y = (int) ((1
- ((Number) bSpinner.getValue()).intValue() / LSPINNER_VALUE) * IMG_HEIGHT); - ((Number) bSpinner.getValue()).intValue() / LSPINNER_VALUE) * IMG_HEIGHT);
@ -537,8 +560,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel
if (slider != null) { if (slider != null) {
slider.setValue(((Number) bSpinner.getValue()).intValue()); slider.setValue(((Number) bSpinner.getValue()).intValue());
} }
if (! handlingMouse) if (!handlingMouse) {
{
gradientPoint.x = (int) (((Number) hSpinner.getValue()).intValue() / HSPINNER_VALUE * IMG_WIDTH); gradientPoint.x = (int) (((Number) hSpinner.getValue()).intValue() / HSPINNER_VALUE * IMG_WIDTH);
gradientPoint.y = (int) ((1 gradientPoint.y = (int) ((1
- ((Number) sSpinner.getValue()).intValue() / SSPINNER_VALUE) * IMG_HEIGHT); - ((Number) sSpinner.getValue()).intValue() / SSPINNER_VALUE) * IMG_HEIGHT);
@ -556,8 +578,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel
getColorSelectionModel().setSelectedColor(new Color(Color.HSBtoRGB(h, s, b))); getColorSelectionModel().setSelectedColor(new Color(Color.HSBtoRGB(h, s, b)));
spinnerTrigger = false; spinnerTrigger = false;
if (! handlingMouse && slider != null && ! slider.getValueIsAdjusting()) if (!handlingMouse && slider != null && !slider.getValueIsAdjusting()) {
{
updateImage(); updateImage();
updateTrack(); updateTrack();
} }
@ -569,8 +590,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel
/** /**
* This method builds the DefaultHSBChooserPanel. * This method builds the DefaultHSBChooserPanel.
*/ */
protected void buildChooser() protected void buildChooser() {
{
setLayout(new BorderLayout()); setLayout(new BorderLayout());
add(buildRightPanel(), BorderLayout.EAST); add(buildRightPanel(), BorderLayout.EAST);
JPanel container = new JPanel(); JPanel container = new JPanel();
@ -604,15 +624,12 @@ class CustomChooserPanel extends AbstractColorChooserPanel
} }
private JPanel createGradientPanel() { private JPanel createGradientPanel() {
return new JPanel() return new JPanel() {
{ public Dimension getPreferredSize() {
public Dimension getPreferredSize()
{
return new Dimension(IMG_WIDTH, IMG_HEIGHT); return new Dimension(IMG_WIDTH, IMG_HEIGHT);
} }
public void paint(Graphics g) public void paint(Graphics g) {
{
if (gradientImage != null) { if (gradientImage != null) {
g.drawImage(gradientImage, 0, 0, this); g.drawImage(gradientImage, 0, 0, this);
} }
@ -626,15 +643,12 @@ class CustomChooserPanel extends AbstractColorChooserPanel
} }
private JPanel createTrackPanel() { private JPanel createTrackPanel() {
return new JPanel() return new JPanel() {
{ public Dimension getPreferredSize() {
public Dimension getPreferredSize()
{
return new Dimension(TRACK_WIDTH, IMG_HEIGHT); return new Dimension(TRACK_WIDTH, IMG_HEIGHT);
} }
public void paint(Graphics g) public void paint(Graphics g) {
{
if (trackImage != null) { if (trackImage != null) {
g.drawImage(trackImage, 0, 0, this); g.drawImage(trackImage, 0, 0, this);
} }
@ -648,8 +662,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel
* *
* @param chooser The JColorChooser to remove this panel from. * @param chooser The JColorChooser to remove this panel from.
*/ */
public void uninstallChooserPanel(JColorChooser chooser) public void uninstallChooserPanel(JColorChooser chooser) {
{
trackImage = null; trackImage = null;
gradientImage = null; gradientImage = null;
gradientPanel = null; gradientPanel = null;
@ -673,8 +686,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel
* *
* @return The right side panel. * @return The right side panel.
*/ */
private Container buildRightPanel() private Container buildRightPanel() {
{
JPanel container = new JPanel(); JPanel container = new JPanel();
container.setLayout(new FlowLayout(FlowLayout.RIGHT)); container.setLayout(new FlowLayout(FlowLayout.RIGHT));
@ -697,6 +709,8 @@ class CustomChooserPanel extends AbstractColorChooserPanel
hexPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 8, 0)); hexPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 8, 0));
hexPanel.add(new UILabel("#")); hexPanel.add(new UILabel("#"));
hexPanel.add(field); hexPanel.add(field);
UIButton pickColorButton = PickColorButtonFactory.getPickColorButton(this, PickColorButtonFactory.IconType.ICON18, true);
hexPanel.add(pickColorButton);
mainPanel.add(hslAndRgbPanel, BorderLayout.CENTER); mainPanel.add(hslAndRgbPanel, BorderLayout.CENTER);
mainPanel.add(hexPanel, BorderLayout.SOUTH); mainPanel.add(hexPanel, BorderLayout.SOUTH);
@ -802,8 +816,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel
* *
* @return The small display icon. * @return The small display icon.
*/ */
public Icon getSmallDisplayIcon() public Icon getSmallDisplayIcon() {
{
return null; return null;
} }
@ -812,8 +825,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel
* *
* @return The large display icon. * @return The large display icon.
*/ */
public Icon getLargeDisplayIcon() public Icon getLargeDisplayIcon() {
{
return null; return null;
} }
@ -821,14 +833,12 @@ class CustomChooserPanel extends AbstractColorChooserPanel
* This method updates the gradient image with a new one taking the Hue * This method updates the gradient image with a new one taking the Hue
* value as the constant. * value as the constant.
*/ */
private void updateHLockImage() private void updateHLockImage() {
{
int index = 0; int index = 0;
int[] pix = new int[IMG_WIDTH * IMG_HEIGHT]; int[] pix = new int[IMG_WIDTH * IMG_HEIGHT];
float hValue = ((Number) hSpinner.getValue()).intValue() / HSPINNER_VALUE; float hValue = ((Number) hSpinner.getValue()).intValue() / HSPINNER_VALUE;
for (int j = 0; j < IMG_HEIGHT; j++) for (int j = 0; j < IMG_HEIGHT; j++) {
{
for (int i = 0; i < IMG_WIDTH; i++) { for (int i = 0; i < IMG_WIDTH; i++) {
pix[index++] = Color.HSBtoRGB(hValue, (IMG_WIDTH - i * 1f) / IMG_WIDTH, pix[index++] = Color.HSBtoRGB(hValue, (IMG_WIDTH - i * 1f) / IMG_WIDTH,
(IMG_HEIGHT - j * 1f) / IMG_HEIGHT) | (BINARY_FOR_EIGHT << TWENTY_FOUR); (IMG_HEIGHT - j * 1f) / IMG_HEIGHT) | (BINARY_FOR_EIGHT << TWENTY_FOUR);
@ -843,8 +853,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel
* This method updates the gradient image with a new one taking the * This method updates the gradient image with a new one taking the
* Brightness value as the constant. * Brightness value as the constant.
*/ */
private void updateBLockImage() private void updateBLockImage() {
{
int[] pix = new int[IMG_WIDTH * IMG_HEIGHT]; int[] pix = new int[IMG_WIDTH * IMG_HEIGHT];
float bValue = ((Number) bSpinner.getValue()).intValue() / LSPINNER_VALUE; float bValue = ((Number) bSpinner.getValue()).intValue() / LSPINNER_VALUE;
@ -864,8 +873,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel
* This method updates the gradient image with a new one taking the * This method updates the gradient image with a new one taking the
* Saturation value as the constant. * Saturation value as the constant.
*/ */
private void updateSLockImage() private void updateSLockImage() {
{
int[] pix = new int[IMG_WIDTH * IMG_HEIGHT]; int[] pix = new int[IMG_WIDTH * IMG_HEIGHT];
float sValue = ((Number) sSpinner.getValue()).intValue() / SSPINNER_VALUE; float sValue = ((Number) sSpinner.getValue()).intValue() / SSPINNER_VALUE;
@ -885,10 +893,8 @@ class CustomChooserPanel extends AbstractColorChooserPanel
* This method calls the appropriate method to update the gradient image * This method calls the appropriate method to update the gradient image
* depending on which HSB value is constant. * depending on which HSB value is constant.
*/ */
private void updateImage() private void updateImage() {
{ switch (locked) {
switch (locked)
{
case HLOCKED: case HLOCKED:
updateHLockImage(); updateHLockImage();
break; break;
@ -904,8 +910,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel
/** /**
* This method updates the TextFields with the correct RGB values. * This method updates the TextFields with the correct RGB values.
*/ */
private void updateTextFields() private void updateTextFields() {
{
int c = getColorSelectionModel().getSelectedColor().getRGB(); int c = getColorSelectionModel().getSelectedColor().getRGB();
removeRGBSpinnerChangeLisener(); removeRGBSpinnerChangeLisener();
@ -929,8 +934,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel
bbSpinner.addChangeListener(rgbScroll); bbSpinner.addChangeListener(rgbScroll);
} }
private void updateHexFields() private void updateHexFields() {
{
Color color = getColorSelectionModel().getSelectedColor(); Color color = getColorSelectionModel().getSelectedColor();
String R = Integer.toHexString(color.getRed()); String R = Integer.toHexString(color.getRed());
@ -953,23 +957,19 @@ class CustomChooserPanel extends AbstractColorChooserPanel
* This method updates the slider in response to making a different HSB * This method updates the slider in response to making a different HSB
* property the constant. * property the constant.
*/ */
private void updateSlider() private void updateSlider() {
{
if (slider == null) { if (slider == null) {
return; return;
} }
slider.setMinimum(0); slider.setMinimum(0);
if (locked == HLOCKED) if (locked == HLOCKED) {
{
internalChange = true; internalChange = true;
slider.setValue(((Number) hSpinner.getValue()).intValue()); slider.setValue(((Number) hSpinner.getValue()).intValue());
slider.setMaximum(359); slider.setMaximum(359);
internalChange = false; internalChange = false;
slider.setInverted(true); slider.setInverted(true);
} } else {
else
{
slider.setInverted(false); slider.setInverted(false);
if (locked == SLOCKED) { if (locked == SLOCKED) {
slider.setValue(((Number) sSpinner.getValue()).intValue()); slider.setValue(((Number) sSpinner.getValue()).intValue());
@ -986,10 +986,8 @@ class CustomChooserPanel extends AbstractColorChooserPanel
* This method updates the track gradient image depending on which HSB * This method updates the track gradient image depending on which HSB
* property is constant. * property is constant.
*/ */
private void updateTrack() private void updateTrack() {
{ switch (locked) {
switch (locked)
{
case HLOCKED: case HLOCKED:
updateHTrack(); updateHTrack();
break; break;
@ -1006,8 +1004,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel
* This method updates the track gradient image if the Hue value is allowed * This method updates the track gradient image if the Hue value is allowed
* to change (according to the UIRadioButtons). * to change (according to the UIRadioButtons).
*/ */
private void updateHTrack() private void updateHTrack() {
{
int trackIndex = 0; int trackIndex = 0;
int[] trackPix = new int[TRACK_WIDTH * IMG_HEIGHT]; int[] trackPix = new int[TRACK_WIDTH * IMG_HEIGHT];
@ -1026,8 +1023,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel
* This method updates the track gradient image if the Saturation value is * This method updates the track gradient image if the Saturation value is
* allowed to change (according to the UIRadioButtons). * allowed to change (according to the UIRadioButtons).
*/ */
private void updateSTrack() private void updateSTrack() {
{
int[] trackPix = new int[TRACK_WIDTH * IMG_HEIGHT]; int[] trackPix = new int[TRACK_WIDTH * IMG_HEIGHT];
float hValue = ((Number) hSpinner.getValue()).intValue() / HSPINNER_VALUE; float hValue = ((Number) hSpinner.getValue()).intValue() / HSPINNER_VALUE;
@ -1050,8 +1046,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel
* This method updates the track gradient image if the Brightness value is * This method updates the track gradient image if the Brightness value is
* allowed to change (according to the UIRadioButtons). * allowed to change (according to the UIRadioButtons).
*/ */
private void updateBTrack() private void updateBTrack() {
{
int[] trackPix = new int[TRACK_WIDTH * IMG_HEIGHT]; int[] trackPix = new int[TRACK_WIDTH * IMG_HEIGHT];
float hValue = ((Number) hSpinner.getValue()).intValue() / HSPINNER_VALUE; float hValue = ((Number) hSpinner.getValue()).intValue() / HSPINNER_VALUE;
@ -1069,4 +1064,15 @@ class CustomChooserPanel extends AbstractColorChooserPanel
trackPix, 0, TRACK_WIDTH)); trackPix, 0, TRACK_WIDTH));
} }
public Color getColor() {
return getColorSelectionModel().getSelectedColor();
}
public void setColor(Color color) {
getColorSelectionModel().setSelectedColor(color);
}
public void colorSetted(ColorCell cc) {
}
} }

17
designer_base/src/com/fr/design/style/color/NewColorSelectPane.java

@ -79,9 +79,20 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
JPanel centerPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); JPanel centerPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane();
this.add(centerPane, BorderLayout.CENTER); this.add(centerPane, BorderLayout.CENTER);
// 第一行,1个取色按钮 + 7个最近使用的颜色
JPanel row1Pane = new JPanel(FRGUIPaneFactory.createBorderLayout());
row1Pane.setBorder(BorderFactory.createEmptyBorder(8, 8, 0, 0));
row1Pane.setPreferredSize(new Dimension(135, 16)); // 宽度为 16 * 8 + 7
centerPane.add(row1Pane);
// 取色按钮
UIButton pickColorButton = PickColorButtonFactory.getPickColorButton(this, PickColorButtonFactory.IconType.ICON16);
row1Pane.add(pickColorButton, BorderLayout.WEST);
// 最近使用 // 最近使用
usedColorPane = new UsedColorPane(1, 8, ColorSelectConfigManager.getInstance().getColors(),this); usedColorPane = new UsedColorPane(1, 7, ColorSelectConfigManager.getInstance().getColors(),this);
centerPane.add(usedColorPane.getPane()); usedColorPane.getPane().setBorder(BorderFactory.createEmptyBorder(0, 1, 0, 8));
row1Pane.add(usedColorPane.getPane());
JPanel menuColorPane1 = new JPanel(); JPanel menuColorPane1 = new JPanel();
centerPane.add(menuColorPane1); centerPane.add(menuColorPane1);
@ -204,4 +215,6 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
usedColorPane.updateUsedColor(); usedColorPane.updateUsedColor();
} }
} }

46
designer_base/src/com/fr/design/style/color/PickColorButtonFactory.java

@ -0,0 +1,46 @@
package com.fr.design.style.color;
import com.fr.base.BaseUtils;
import com.fr.design.gui.ibutton.UIButton;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* Created by plough on 2016/12/22.
*/
public class PickColorButtonFactory {
public static UIButton getPickColorButton(ColorSelectable colorSelectable, IconType iconType) {
return getPickColorButton(colorSelectable, iconType, false);
}
public static UIButton getPickColorButton(final ColorSelectable colorSelectable, IconType iconType, final Boolean setColorRealTime) {
UIButton pickColorButton = new UIButton();
if (iconType == IconType.ICON16) {
pickColorButton.setIcon(BaseUtils.readIcon("/com/fr/design/images/gui/colorPicker/colorPicker16.png"));
pickColorButton.setPreferredSize(new Dimension(16, 16));
} else {
pickColorButton.setIcon(BaseUtils.readIcon("/com/fr/design/images/gui/colorPicker/colorPicker18.png"));
pickColorButton.setPreferredSize(new Dimension(18, 18));
}
pickColorButton.setCursor(new Cursor(Cursor.HAND_CURSOR));
pickColorButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
ColorPicker colorPicker = new ColorPicker(colorSelectable, setColorRealTime);
colorPicker.start();
}
});
return pickColorButton;
}
// 取色器按钮使用的图标
public enum IconType {
ICON16, ICON18
}
}

2
designer_base/src/com/fr/env/RemoteEnv.java vendored

@ -513,9 +513,11 @@ public class RemoteEnv implements Env {
} }
private void stopLogTimer() { private void stopLogTimer() {
if(logTimer != null) {
logTimer.cancel(); logTimer.cancel();
logTimer = null; logTimer = null;
} }
}
/** /**
* 根据userID sign out * 根据userID sign out

8
designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java

@ -260,7 +260,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
while (iterator.hasNext()){ while (iterator.hasNext()){
Map.Entry entry = (Map.Entry) iterator.next(); Map.Entry entry = (Map.Entry) iterator.next();
IndependentChartUIProvider provider = (IndependentChartUIProvider) entry.getValue(); IndependentChartUIProvider provider = (IndependentChartUIProvider) entry.getValue();
names[i++] = provider.getPlotTypePane().title4PopupWindow(); names[i++] = provider.getPlotTypeTitle4PopupWindow();
} }
return names; return names;
} }
@ -275,7 +275,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
public String getTitle4PopupWindow(String priority, String plotID){ public String getTitle4PopupWindow(String priority, String plotID){
if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(priority) && chartTypeInterfaces.get(priority).containsKey(plotID)){ if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(priority) && chartTypeInterfaces.get(priority).containsKey(plotID)){
IndependentChartUIProvider provider = chartTypeInterfaces.get(priority).get(plotID); IndependentChartUIProvider provider = chartTypeInterfaces.get(priority).get(plotID);
return provider.getPlotTypePane().title4PopupWindow(); return provider.getPlotTypeTitle4PopupWindow();
} }
//兼容老的插件 //兼容老的插件
@ -285,7 +285,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
Map.Entry entry = (Map.Entry) iterator.next(); Map.Entry entry = (Map.Entry) iterator.next();
String defaultPriority = (String) entry.getKey(); String defaultPriority = (String) entry.getKey();
if (chartTypeInterfaces.get(defaultPriority).containsKey(plotID)) { if (chartTypeInterfaces.get(defaultPriority).containsKey(plotID)) {
return chartTypeInterfaces.get(defaultPriority).get(plotID).getPlotTypePane().title4PopupWindow(); return chartTypeInterfaces.get(defaultPriority).get(plotID).getPlotTypeTitle4PopupWindow();
} }
} }
} }
@ -333,7 +333,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
while (chartUI.hasNext()) { while (chartUI.hasNext()) {
Map.Entry chartUIEntry = (Map.Entry) chartUI.next(); Map.Entry chartUIEntry = (Map.Entry) chartUI.next();
IndependentChartUIProvider provider = (IndependentChartUIProvider) chartUIEntry.getValue(); IndependentChartUIProvider provider = (IndependentChartUIProvider) chartUIEntry.getValue();
names[index++] = provider.getPlotTypePane().title4PopupWindow(); names[index++] = provider.getPlotTypeTitle4PopupWindow();
} }
return index; return index;
} }

5
designer_chart/src/com/fr/design/chart/fun/IndependentChartUIProvider.java

@ -84,5 +84,10 @@ public interface IndependentChartUIProvider extends Level {
*/ */
String getIconPath(); String getIconPath();
/**
* plot面板的标题
*/
String getPlotTypeTitle4PopupWindow();
} }

8
designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java

@ -57,4 +57,12 @@ public abstract class AbstractIndependentChartUIWithAPILevel implements Independ
public ConditionAttributesPane getPlotConditionPane(Plot plot){ public ConditionAttributesPane getPlotConditionPane(Plot plot){
return new DataSeriesConditionPane(); return new DataSeriesConditionPane();
} }
/**
* plot面板的标题
* 插件兼容
*/
public String getPlotTypeTitle4PopupWindow(){
return getPlotTypePane().title4PopupWindow();
}
} }

2
designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java

@ -138,7 +138,7 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
private void checkoutChange(){ private void checkoutChange(){
editingCollection.calculateMultiChartMode(); editingCollection.calculateMultiChartMode();
if (parent != null){ if (parent != null){
parent.reactorChartTypePane(editingCollection); parent.relayoutChartTypePane(editingCollection);
} }
//检查是否可以配置切换 //检查是否可以配置切换
configButton.setEnabled(editingCollection.changeEnable()); configButton.setEnabled(editingCollection.changeEnable());

19
designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypePane.java

@ -69,7 +69,12 @@ public class ChartTypePane extends AbstractChartAttrPane{
buttonPane = new ChartTypeButtonPane(this); buttonPane = new ChartTypeButtonPane(this);
content.add(buttonPane, BorderLayout.NORTH); content.add(buttonPane, BorderLayout.NORTH);
if (editingCollection != null) {
relayoutChartTypePane(editingCollection);
}else {
chartTypePane = new ComboBoxPane(); chartTypePane = new ComboBoxPane();
}
BasicScrollPane scrollPane = new BasicScrollPane() { BasicScrollPane scrollPane = new BasicScrollPane() {
@Override @Override
protected JPanel createContentPane() { protected JPanel createContentPane() {
@ -192,7 +197,7 @@ public class ChartTypePane extends AbstractChartAttrPane{
}); });
} }
public void reactor(ChartCollection collection){ public void relayout(ChartCollection collection){
//重构需要重构下拉框选项和cardNames //重构需要重构下拉框选项和cardNames
Chart chart = collection.getSelectedChart(); Chart chart = collection.getSelectedChart();
String chartID = chart.getPriority(); String chartID = chart.getPriority();
@ -278,9 +283,9 @@ public class ChartTypePane extends AbstractChartAttrPane{
} }
public void reactorChartTypePane(ChartCollection collection){ public void relayoutChartTypePane(ChartCollection collection){
if (needReactor(collection)) { if (needRelayout(collection)) {
chartTypePane.reactor(collection); chartTypePane.relayout(collection);
//设置面板切换状态 //设置面板切换状态
updatePaneState(collection); updatePaneState(collection);
} }
@ -292,7 +297,7 @@ public class ChartTypePane extends AbstractChartAttrPane{
} }
// TODO: 2016/11/17 因为现在populate面板时会重新构造面板,所以每次都需要重构 // TODO: 2016/11/17 因为现在populate面板时会重新构造面板,所以每次都需要重构
private boolean needReactor(ChartCollection collection) { private boolean needRelayout(ChartCollection collection) {
/*return paneState.getChartID() != collection.getRepresentChartID() || paneState.getPaneState() != collection.getState();*/ /*return paneState.getChartID() != collection.getRepresentChartID() || paneState.getPaneState() != collection.getState();*/
return true; return true;
} }
@ -301,14 +306,14 @@ public class ChartTypePane extends AbstractChartAttrPane{
* 更新界面属性 用于展示 * 更新界面属性 用于展示
*/ */
public void populate(ChartCollection collection) { public void populate(ChartCollection collection) {
editingCollection = collection;
Chart chart = collection.getSelectedChart(); Chart chart = collection.getSelectedChart();
this.remove(leftContentPane); this.remove(leftContentPane);
initContentPane(); initContentPane();
buttonPane.populateBean(collection); buttonPane.populateBean(collection);
chartTypePane.populateBean(chart); chartTypePane.populateBean(chart);
//remove面板之后,就需要重构下拉框
reactorChartTypePane(collection);
this.initAllListeners(); this.initAllListeners();
} }

3
designer_form/src/com/fr/design/designer/creator/XCreator.java

@ -426,7 +426,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
*/ */
public boolean acceptType(Class<?>... acceptTypes) { public boolean acceptType(Class<?>... acceptTypes) {
for (Class<?> type : acceptTypes) { for (Class<?> type : acceptTypes) {
if (StableUtils.classInstanceOf(this.getClass(), type)) { if (StableUtils.objectInstanceOf(this, type)) {
return true; return true;
} }
} }
@ -617,4 +617,5 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
public void adjustCompHeight(double percent) { public void adjustCompHeight(double percent) {
return; return;
} }
} }

5
designer_form/src/com/fr/design/designer/creator/XElementCase.java

@ -100,7 +100,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
.setI18NName(Inter.getLocText("Form-EC_toolbar")) .setI18NName(Inter.getLocText("Form-EC_toolbar"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")
}; };
resolveCompatible(propertyTableEditor); propertyTableEditor = resolveCompatible(propertyTableEditor);
FormElementCaseEditorProcessor processor = ExtraDesignClassManager.getInstance().getSingle(FormElementCaseEditorProcessor.MARK_STRING); FormElementCaseEditorProcessor processor = ExtraDesignClassManager.getInstance().getSingle(FormElementCaseEditorProcessor.MARK_STRING);
if (processor == null) { if (processor == null) {
return propertyTableEditor; return propertyTableEditor;
@ -122,7 +122,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
} }
private void resolveCompatible (CRPropertyDescriptor[] propertyTableEditor) { private CRPropertyDescriptor[] resolveCompatible (CRPropertyDescriptor[] propertyTableEditor) {
//这边有个插件兼容问题,之后还是要改回process才行 //这边有个插件兼容问题,之后还是要改回process才行
Set<FormElementCaseEditorProvider> set = ExtraDesignClassManager.getInstance().getArray(AbstractFormElementCaseEditorProvider.MARK_STRING); Set<FormElementCaseEditorProvider> set = ExtraDesignClassManager.getInstance().getArray(AbstractFormElementCaseEditorProvider.MARK_STRING);
for (FormElementCaseEditorProvider provider : set) { for (FormElementCaseEditorProvider provider : set) {
@ -135,6 +135,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
PropertyDescriptor[] extraEditor = provider.createPropertyDescriptor(this.data.getClass(), formProvider, elementCaseEditorProvider); PropertyDescriptor[] extraEditor = provider.createPropertyDescriptor(this.data.getClass(), formProvider, elementCaseEditorProvider);
propertyTableEditor = (CRPropertyDescriptor[]) ArrayUtils.addAll(propertyTableEditor, extraEditor); propertyTableEditor = (CRPropertyDescriptor[]) ArrayUtils.addAll(propertyTableEditor, extraEditor);
} }
return propertyTableEditor;
} }
@Override @Override

8
designer_form/src/com/fr/design/designer/creator/XWAbsoluteBodyLayout.java

@ -2,7 +2,9 @@ package com.fr.design.designer.creator;
import com.fr.design.designer.beans.LayoutAdapter; import com.fr.design.designer.beans.LayoutAdapter;
import com.fr.design.designer.beans.adapters.layout.FRAbsoluteBodyLayoutAdapter; import com.fr.design.designer.beans.adapters.layout.FRAbsoluteBodyLayoutAdapter;
import com.fr.design.designer.properties.mobile.BodyMobilePropertyUI;
import com.fr.design.form.util.XCreatorConstants; import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.mainframe.widget.editors.PaddingMarginEditor; import com.fr.design.mainframe.widget.editors.PaddingMarginEditor;
import com.fr.design.mainframe.widget.editors.WLayoutBorderStyleEditor; import com.fr.design.mainframe.widget.editors.WLayoutBorderStyleEditor;
import com.fr.design.mainframe.widget.renderer.LayoutBorderStyleRenderer; import com.fr.design.mainframe.widget.renderer.LayoutBorderStyleRenderer;
@ -87,8 +89,14 @@ public class XWAbsoluteBodyLayout extends XWAbsoluteLayout {
}; };
} }
@Override
public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() {
return new WidgetPropertyUIProvider[]{ new BodyMobilePropertyUI(this)};
}
@Override @Override
protected void initStyle() { protected void initStyle() {
initBorderStyle(); initBorderStyle();
} }
} }

1
designer_form/src/com/fr/design/designer/creator/XWFitLayout.java

@ -25,6 +25,7 @@ import com.fr.form.ui.container.WBodyLayoutType;
import com.fr.form.ui.container.WFitLayout; import com.fr.form.ui.container.WFitLayout;
import com.fr.form.ui.container.WLayout; import com.fr.form.ui.container.WLayout;
import com.fr.general.FRScreen; import com.fr.general.FRScreen;
import com.fr.general.Inter;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
/** /**

11
designer_form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java

@ -14,7 +14,9 @@ import com.fr.design.designer.creator.CRPropertyDescriptor;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.properties.mobile.BodyMobilePropertyUI;
import com.fr.design.form.util.XCreatorConstants; import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.FormHierarchyTreePane; import com.fr.design.mainframe.FormHierarchyTreePane;
import com.fr.design.mainframe.widget.editors.PaddingMarginEditor; import com.fr.design.mainframe.widget.editors.PaddingMarginEditor;
@ -367,4 +369,13 @@ public class XWTabFitLayout extends XWFitLayout {
public XLayoutContainer getTopLayout() { public XLayoutContainer getTopLayout() {
return this.getBackupParent().getTopLayout(); return this.getBackupParent().getTopLayout();
} }
/**
* 重写这个方法解决tab块底下仍然显示手机重布局的bug
* @return
*/
@Override
public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() {
return new WidgetPropertyUIProvider[0];
}
} }

4
designer_form/src/com/fr/design/designer/properties/BodyAppRelayoutTable.java

@ -53,7 +53,7 @@ public class BodyAppRelayoutTable extends AbstractPropertyTable {
FRContext.getLogger().error(e.getMessage()); FRContext.getLogger().error(e.getMessage());
} }
groups.add(new PropertyGroup(new ReportAppPropertyGroupModel(Inter.getLocText("FR-Designer-Layout_Adaptive_Layout"), xCreator, propertyTableEditor, designer))); groups.add(new PropertyGroup(new ReportAppPropertyGroupModel(Inter.getLocText("FR-Designer_Properties_Mobile"), xCreator, propertyTableEditor, designer)));
TableModel model = new BeanTableModel(); TableModel model = new BeanTableModel();
setModel(model); setModel(model);
@ -65,7 +65,7 @@ public class BodyAppRelayoutTable extends AbstractPropertyTable {
* 单元格tooltip * 单元格tooltip
* 属性名悬浮提示 * 属性名悬浮提示
* *
* @param 鼠标点击事件 * @param event 鼠标点击事件
* @return 单元格tooltip * @return 单元格tooltip
*/ */
public String getToolTipText(MouseEvent event) { public String getToolTipText(MouseEvent event) {

5
designer_form/src/com/fr/design/designer/properties/mobile/BodyMobilePropertyUI.java

@ -1,6 +1,7 @@
package com.fr.design.designer.properties.mobile; package com.fr.design.designer.properties.mobile;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XWAbsoluteBodyLayout;
import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.properties.BodyAppRelayoutTable; import com.fr.design.designer.properties.BodyAppRelayoutTable;
import com.fr.design.fun.impl.AbstractWidgetPropertyUIProvider; import com.fr.design.fun.impl.AbstractWidgetPropertyUIProvider;
@ -18,6 +19,10 @@ public class BodyMobilePropertyUI extends AbstractWidgetPropertyUIProvider {
this.xCreator = xwFitLayout; this.xCreator = xwFitLayout;
} }
public BodyMobilePropertyUI(XWAbsoluteBodyLayout xwAbsoluteBodyLayout) {
this.xCreator = xwAbsoluteBodyLayout;
}
@Override @Override
public AbstractPropertyTable createWidgetAttrTable() { public AbstractPropertyTable createWidgetAttrTable() {
return new BodyAppRelayoutTable(xCreator); return new BodyAppRelayoutTable(xCreator);

Loading…
Cancel
Save