Browse Source

Merge branch 'release/9.0' of http://www.finedevelop.com:2015/scm/~vito/design into release/9.0

# Conflicts:
#	designer_base/src/com/fr/design/locale/designer_ja_JP.properties
master
vito 7 years ago
parent
commit
bb2bdbdce0
  1. 8
      designer/src/com/fr/design/dscolumn/ResultSetGroupDockingPane.java
  2. 40
      designer/src/com/fr/design/mainframe/JWorkBook.java
  3. 7
      designer/src/com/fr/design/mainframe/form/FormReportComponentComposite.java
  4. 10
      designer/src/com/fr/poly/PolyUtils.java
  5. 2
      designer/src/com/fr/quickeditor/CellQuickEditor.java
  6. 65
      designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java
  7. 16
      designer_base/src/com/fr/design/extra/PluginWebBridge.java
  8. 9
      designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java
  9. 7
      designer_base/src/com/fr/design/gui/icombobox/UIComboBoxUI.java
  10. 748
      designer_base/src/com/fr/design/layout/TableLayoutHelper.java
  11. 4
      designer_base/src/com/fr/design/locale/designer.properties
  12. 2
      designer_base/src/com/fr/design/locale/designer_en_US.properties
  13. 7
      designer_base/src/com/fr/design/locale/designer_ja_JP.properties
  14. 7
      designer_base/src/com/fr/design/locale/designer_ko_KR.properties
  15. 2
      designer_base/src/com/fr/design/locale/designer_zh_CN.properties
  16. 2
      designer_base/src/com/fr/design/locale/designer_zh_TW.properties
  17. 22
      designer_base/src/com/fr/design/mainframe/JSliderPane.java
  18. 40
      designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java
  19. 101
      designer_form/src/com/fr/design/widget/ui/designer/mobile/ElementCaseDefinePane.java
  20. 17
      designer_form/src/com/fr/design/widget/ui/designer/mobile/MobileWidgetDefinePane.java

8
designer/src/com/fr/design/dscolumn/ResultSetGroupDockingPane.java

@ -34,6 +34,7 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane {
private UIButton advancedButton;
private FunctionComboBox functionComboBox;
private JPanel contentPane;
private JPanel cardPane;
private CardLayout cardLayout;
private UIComboBox goBox;
@ -48,9 +49,9 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane {
public void initComponents(ElementCasePane ePane) {
goBox = new UIComboBox(new String[]{Inter.getLocText("BindColumn-Group"), Inter.getLocText("BindColumn-Select"), Inter.getLocText("BindColumn-Summary")});
initCardPane();
JPanel pane = layoutPane();
contentPane = layoutPane();
this.setLayout(new BorderLayout());
this.add(pane, BorderLayout.CENTER);
this.add(contentPane, BorderLayout.CENTER);
}
private JPanel layoutPane() {
@ -70,12 +71,15 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane {
if (i == BIND_GROUP) {
cardLayout.show(cardPane, "groupPane");
cardPane.setPreferredSize(new Dimension(156, 20));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane,2,10);
} else if (i == BIND_SELECTED) {
cardLayout.show(cardPane, "listPane");
cardPane.setPreferredSize(new Dimension(0, 0));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane,2,0);
} else if (i == BIND_SUMMARY) {
cardLayout.show(cardPane, "summaryPane");
cardPane.setPreferredSize(new Dimension(156, 20));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane,2,10);
CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr();
cellExpandAttr.setDirection(Constants.NONE);
}

40
designer/src/com/fr/design/mainframe/JWorkBook.java

@ -87,6 +87,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
private static final String SHARE_SUFFIX = "_share";
private static final String SHARE_FOLDER = "share";
private static final int TOOLBARPANEDIMHEIGHT = 26;
private static final double MIN_TIME = 0.4;
private UIModeControlContainer centerPane;
public ReportComponentComposite reportComposite;
@ -363,7 +364,13 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
this.resolution = resolution;
ElementCasePane elementCasePane = reportComposite.centerCardPane.editingComponet.elementCasePane;
PolyDesigner polyDezi = reportComposite.centerCardPane.getPolyDezi();
if (elementCasePane != null){
if (elementCasePane != null) {
//网格线
if (resolution < ScreenResolution.getScreenResolution() * MIN_TIME) {
elementCasePane.getGrid().setShowGridLine(false);
} else {
elementCasePane.getGrid().setShowGridLine(true);
}
elementCasePane.setResolution(resolution);
elementCasePane.getGrid().getGridMouseAdapter().setResolution(resolution);
elementCasePane.getGrid().setResolution(resolution);
@ -375,29 +382,30 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
grid.setHorizontalExtent(GridUtils.getExtentValue(0, columnWidthList, grid.getWidth(), resolution));
elementCasePane.getGrid().updateUI();
//更新Column和Row
((DynamicScrollBar)elementCasePane.getVerticalScrollBar()).setDpi(resolution);
((DynamicScrollBar)elementCasePane.getHorizontalScrollBar()).setDpi(resolution);
((DynamicScrollBar) elementCasePane.getVerticalScrollBar()).setDpi(resolution);
((DynamicScrollBar) elementCasePane.getHorizontalScrollBar()).setDpi(resolution);
elementCasePane.getGridColumn().setResolution(resolution);
elementCasePane.getGridColumn().updateUI();
elementCasePane.getGridRow().setResolution(resolution);
elementCasePane.getGridRow().updateUI();
}
if (polyDezi != null){
if (polyDezi != null) {
polyDezi.setResolution(resolution);
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setJTemplateResolution(resolution);
polyDezi.updateUI();
}
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().fireTargetModified();
}
@Override
public int selfAdaptUpdate(){
public int selfAdaptUpdate() {
PolyDesigner polyDezi = reportComposite.centerCardPane.getPolyDezi();
ElementCasePane elementCasePane = reportComposite.centerCardPane.editingComponet.elementCasePane;
if (resolution == 0){
if (resolution == 0) {
resolution = ScreenResolution.getScreenResolution();
}
if (polyDezi != null && polyDezi.getSelection() != null){
BlockCreator blockCreator =polyDezi.getSelection();
if (polyDezi != null && polyDezi.getSelection() != null) {
BlockCreator blockCreator = polyDezi.getSelection();
double x = blockCreator.getEditorBounds().getX();
double y = blockCreator.getEditorBounds().getY();
polyDezi.setHorizontalValue((int) x);
@ -406,30 +414,33 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
double creatorWidth = blockCreator.getEditorBounds().width;
double areaHeight = polyDezi.polyArea.getHeight();
double areaWidth = polyDezi.polyArea.getWidth();
if (creatorWidth == 0||creatorHeight == 0){
if (creatorWidth == 0 || creatorHeight == 0) {
return resolution;
}
double time =(areaHeight/creatorHeight)<(areaWidth/creatorWidth) ? (areaHeight/creatorHeight) : (areaWidth/creatorWidth);
double time = (areaHeight / creatorHeight) < (areaWidth / creatorWidth) ? (areaHeight / creatorHeight) : (areaWidth / creatorWidth);
return (int) (time * ScreenResolution.getScreenResolution());
}else if (elementCasePane != null) {
} else if (elementCasePane != null) {
ElementCasePane reportPane = elementCasePane.getGrid().getElementCasePane();
if (reportPane.getSelection().getSelectedColumns().length == 0) {
return resolution;
}
int column = reportPane.getSelection().getSelectedColumns()[0];
double columnLength = reportPane.getSelection().getSelectedColumns().length;
double columnExtent = reportPane.getGrid().getHorizontalExtent();
int row = reportPane.getSelection().getSelectedRows()[0];
double rowLength = reportPane.getSelection().getSelectedRows().length;
double rowExtent = reportPane.getGrid().getVerticalExtent();
if (columnLength == 0||rowLength == 0){
if (columnLength == 0 || rowLength == 0) {
return resolution;
}
double time = (columnExtent/columnLength) < (rowExtent/rowLength) ? (columnExtent/columnLength) : (rowExtent/rowLength);
double time = (columnExtent / columnLength) < (rowExtent / rowLength) ? (columnExtent / columnLength) : (rowExtent / rowLength);
if (reportPane.isHorizontalScrollBarVisible()) {
reportPane.getVerticalScrollBar().setValue(row);
reportPane.getHorizontalScrollBar().setValue(column);
}
return (int) (time * elementCasePane.getGrid().getResolution());
}else {
} else {
return resolution;
}
}
@ -790,7 +801,6 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
* 是否支持预览
*
* @return 预览接口
*
*/
public PreviewProvider[] supportPreview() {
Set<PreviewProvider> set = ExtraDesignClassManager.getInstance().getArray(PreviewProvider.MARK_STRING);

7
designer/src/com/fr/design/mainframe/form/FormReportComponentComposite.java

@ -33,6 +33,7 @@ public class FormReportComponentComposite extends JComponent implements TargetMo
private static final int MAX = 400;
private static final int HUND = 100;
private static final int MIN = 10;
private static final double MIN_TIME = 0.4;
public FormElementCaseDesigner elementCaseDesigner;
private BaseJForm jForm;
@ -112,6 +113,12 @@ public class FormReportComponentComposite extends JComponent implements TargetMo
private void setScale(int resolution) {
ElementCasePane elementCasePane = elementCaseDesigner.getEditingElementCasePane();
//网格线
if (resolution < ScreenResolution.getScreenResolution() * MIN_TIME) {
elementCasePane.getGrid().setShowGridLine(false);
} else {
elementCasePane.getGrid().setShowGridLine(true);
}
elementCasePane.setResolution(resolution);
elementCasePane.getGrid().getGridMouseAdapter().setResolution(resolution);
elementCasePane.getGrid().setResolution(resolution);

10
designer/src/com/fr/poly/PolyUtils.java

@ -9,6 +9,7 @@ import java.util.HashMap;
import java.util.Map;
import com.fr.base.FRContext;
import com.fr.base.ScreenResolution;
import com.fr.base.chart.BaseChart;
import com.fr.base.chart.BaseChartCollection;
import com.fr.base.chart.BasePlot;
@ -114,10 +115,11 @@ public class PolyUtils {
AddedData addedData = designer.getAddedData();
for (int count = addedData.getAddedCount() - 1; count >= 0; count--) {
BlockCreator creator = addedData.getAddedAt(count);
int cx = creator.getX();
int cy = creator.getY();
int cw = creator.getWidth();
int ch = creator.getHeight();
float times = (float) designer.getResolution()/ScreenResolution.getScreenResolution();
int cx = (int) (creator.getX() * times);
int cy = (int) (creator.getY() * times);
int cw = (int) (creator.getWidth() * times);
int ch = (int) (creator.getHeight() * times);
if (x >= cx && x <= (cx + cw)) {
if(y >= cy && y <= (cy + ch)) {
return creator;

2
designer/src/com/fr/quickeditor/CellQuickEditor.java

@ -55,7 +55,7 @@ public abstract class CellQuickEditor extends QuickEditor<ElementCasePane> {
emptyLabel.setPreferredSize(new Dimension(60, 20));
}
protected static final int VGAP = 10, HGAP = 8;
protected static final int VGAP = 10, HGAP = 8, VGAP_INNER = 3;
public CellQuickEditor() {

65
designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java

@ -436,12 +436,6 @@ public class CellDSColumnEditor extends CellQuickEditor {
filterPane.update(cellElement);
fireTargetModified();
}
}, new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
filterPane.update(cellElement);
fireTargetModified();
}
}
);
//自定义值显示
@ -489,6 +483,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
}
}, new double[]{P}, new double[]{P, F}, HGAP, VGAP
);
multiPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
multiNumPane.add(multiPane);
useMultiplyNumCheckBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
@ -505,7 +500,6 @@ public class CellDSColumnEditor extends CellQuickEditor {
}
});
double[] rowSize = {P, P, P, P, P, P};
double[] columnSize = {F};
@ -537,6 +531,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
* @see DSColumnAdvancedPane.SortPane
*/
public class ResultSetSortConfigPane extends JPanel {
private JPanel contentPane;
//面板
private UIButtonGroup sortTypePane;
private JFormulaField formulaField;
@ -570,8 +565,10 @@ public class CellDSColumnEditor extends CellQuickEditor {
cardLayout.show(centerPane, noContent ? "none" : "content");
if (noContent) {
centerPane.setPreferredSize(new Dimension(0, 0));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 0);
} else {
centerPane.setPreferredSize(new Dimension(165, 20));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP);
}
}
});
@ -582,9 +579,8 @@ public class CellDSColumnEditor extends CellQuickEditor {
};
double[] rowSize = {P, P}, columnSize = {P, F};
this.add(TableLayoutHelper.createGapTableLayoutPane(
components, rowSize, columnSize, HGAP, VGAP
), BorderLayout.CENTER);
contentPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, HGAP, VGAP);
this.add(contentPane, BorderLayout.CENTER);
}
@ -605,8 +601,10 @@ public class CellDSColumnEditor extends CellQuickEditor {
cardLayout.show(centerPane, noContent ? "none" : "content");
if (noContent) {
centerPane.setPreferredSize(new Dimension(0, 0));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 0);
} else {
centerPane.setPreferredSize(new Dimension(156, 20));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP);
}
String sortFormula = dSColumn.getSortFormula();
if (sortFormula != null && sortFormula.length() >= 1) {
@ -650,7 +648,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
* @see DSColumnAdvancedPane.SelectCountPane
*/
public class ResultSetFilterConfigPane extends JPanel {
private JPanel contentPane;
private UIComboBox rsComboBox;
private JPanel setCardPane;
private JPanel tipCardPane;
@ -681,44 +679,52 @@ public class CellDSColumnEditor extends CellQuickEditor {
tipCardPaneLayout.show(tipCardPane, FilterType.TOP.name());
//隐藏tip 显示set
setCardPane.setPreferredSize(new Dimension(156, 20));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP);
tipCardPane.setPreferredSize(new Dimension(0, 0));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, 0);
} else if (selectIndex == 2) {
//后N个
setCardPaneLayout.show(setCardPane, FilterType.BOTTOM.name());
tipCardPaneLayout.show(tipCardPane, FilterType.BOTTOM.name());
//隐藏tip 显示set
setCardPane.setPreferredSize(new Dimension(156, 20));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP);
tipCardPane.setPreferredSize(new Dimension(0, 0));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, 0);
} else if (selectIndex == 3) {
//奇数
setCardPaneLayout.show(setCardPane, FilterType.ODD.name());
tipCardPaneLayout.show(tipCardPane, FilterType.ODD.name());
//隐藏set 显示tip
setCardPane.setPreferredSize(new Dimension(0, 0));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 0);
tipCardPane.setPreferredSize(new Dimension(224, 40));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, VGAP_INNER);
} else if (selectIndex == 4) {
setCardPaneLayout.show(setCardPane, FilterType.EVEN.name());
tipCardPaneLayout.show(tipCardPane, FilterType.EVEN.name());
//隐藏set 显示tip
setCardPane.setPreferredSize(new Dimension(0, 0));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 0);
tipCardPane.setPreferredSize(new Dimension(224, 40));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, VGAP_INNER);
} else if (selectIndex == 5) {
setCardPaneLayout.show(setCardPane, FilterType.SPECIFY.name());
tipCardPaneLayout.show(tipCardPane, FilterType.SPECIFY.name());
//显示set和tip
setCardPane.setPreferredSize(new Dimension(156, 20));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP);
tipCardPane.setPreferredSize(new Dimension(224, 40));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, VGAP_INNER);
} else {
setCardPaneLayout.show(setCardPane, FilterType.UNDEFINE.name());
tipCardPaneLayout.show(tipCardPane, FilterType.UNDEFINE.name());
//隐藏set和tip
setCardPane.setPreferredSize(new Dimension(0, 0));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 0);
tipCardPane.setPreferredSize(new Dimension(0, 0));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, 0);
}
setCardPane.revalidate();
tipCardPane.revalidate();
setCardPane.repaint();
tipCardPane.repaint();
}
});
//配置展示CardLayout
@ -746,7 +752,6 @@ public class CellDSColumnEditor extends CellQuickEditor {
oddTip.setForeground(TIP_FONT_COLOR);
tipCardPane.add(oddTip, FilterType.ODD.name());
//偶数 UILabel 占一行作为提示信息
setCardPane.add(new JPanel(), FilterType.EVEN.name());
MultilineLabel evenTip = new MultilineLabel(Inter.getLocText("FS-Designer_DS_Filter_Even_Tip"));
@ -759,12 +764,13 @@ public class CellDSColumnEditor extends CellQuickEditor {
MultilineLabel specifyTip = new MultilineLabel(Inter.getLocText("FS-Designer_DS_Filter_Specify_Tip"));
specifyTip.setForeground(TIP_FONT_COLOR);
tipCardPane.add(specifyTip, FilterType.SPECIFY.name());
this.add(TableLayoutHelper.createGapTableLayoutPane(new Component[][]{
contentPane = TableLayoutHelper.createDiffVGapTableLayoutPane(new Component[][]{
{filterLabel, rsComboBox},
{null, setCardPane},
{tipCardPane, null}
}, new double[]{P, P, P}, new double[]{P, F}, HGAP, VGAP), BorderLayout.CENTER);
}, new double[]{P, P, P}, new double[]{P, F}, HGAP, new double[]{VGAP, VGAP_INNER});
this.add(contentPane, BorderLayout.CENTER);
}
public void populate(CellElement cellElement) {
@ -783,39 +789,53 @@ public class CellDSColumnEditor extends CellQuickEditor {
this.topFormulaPane.populate(selectCount.getFormulaCount());
//隐藏tip 显示set
setCardPane.setPreferredSize(new Dimension(156, 20));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP);
tipCardPane.setPreferredSize(new Dimension(0, 0));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, 0);
break;
case SelectCount.BOTTOM:
this.bottomFormulaPane.populate(selectCount.getFormulaCount());
//隐藏tip 显示set
setCardPane.setPreferredSize(new Dimension(156, 20));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP);
tipCardPane.setPreferredSize(new Dimension(0, 0));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, 0);
break;
case SelectCount.SPECIFY:
this.serialTextField.setText(selectCount.getSerial());
//显示set和tip
setCardPane.setPreferredSize(new Dimension(156, 20));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP);
tipCardPane.setPreferredSize(new Dimension(224, 40));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, VGAP_INNER);
break;
case SelectCount.EVEN:
//隐藏set 显示tip
setCardPane.setPreferredSize(new Dimension(0, 0));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 0);
tipCardPane.setPreferredSize(new Dimension(224, 40));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, VGAP_INNER);
break;
case SelectCount.ODD:
//隐藏set 显示tip
setCardPane.setPreferredSize(new Dimension(0, 0));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 0);
tipCardPane.setPreferredSize(new Dimension(224, 40));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, VGAP_INNER);
break;
default:
//隐藏set和tip
setCardPane.setPreferredSize(new Dimension(0, 0));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 0);
tipCardPane.setPreferredSize(new Dimension(0, 0));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, 0);
}
} else {
//隐藏set和tip
setCardPane.setPreferredSize(new Dimension(0, 0));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 0);
tipCardPane.setPreferredSize(new Dimension(0, 0));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, 0);
}
}
}
@ -848,13 +868,12 @@ public class CellDSColumnEditor extends CellQuickEditor {
/**
* 添加事件监听器
*
* @param formulaListener 公式输入框改动事件监听器
* @param actionListener 筛选类型下拉框改动事件监听器
* @param formulaListener 输入框改动事件监听器
*/
public void addListener(UIObserverListener formulaListener, ActionListener actionListener) {
public void addListener(UIObserverListener formulaListener) {
topFormulaPane.addListener(formulaListener);
bottomFormulaPane.addListener(formulaListener);
rsComboBox.addActionListener(actionListener);
rsComboBox.registerChangeListener(formulaListener);
}
}

16
designer_base/src/com/fr/design/extra/PluginWebBridge.java

@ -281,7 +281,7 @@ public class PluginWebBridge {
List<PluginContext> plugins = PluginManager.getContexts();
return plugins.toArray(new PluginContext[plugins.size()]);
}
private String[] jsObjectToStringArray(JSObject obj) {
if (obj == null) {
return ArrayUtils.EMPTY_STRING_ARRAY;
@ -318,7 +318,7 @@ public class PluginWebBridge {
}
public void getPluginPrefix(final JSObject callback){
public void getPluginPrefix(final JSObject callback) {
JSCallback jsCallback = new JSCallback(webEngine, callback);
PluginOperateUtils.getPluginPrefix(jsCallback);
}
@ -383,7 +383,7 @@ public class PluginWebBridge {
public String getLoginInfo(final JSObject callback) {
registerLoginInfo(callback);
BBSUserInfo bbsUserInfo = BBSPluginLogin.getInstance().getUserInfo();
return bbsUserInfo == null ? "": bbsUserInfo.getUserName();
return bbsUserInfo == null ? "" : bbsUserInfo.getUserName();
}
/**
@ -510,8 +510,8 @@ public class PluginWebBridge {
}
//通过QQ登录后通知登录
public void ucsynLogin(long uid, String username){
BBSUserInfo bbsUserInfo = new BBSUserInfo(username, "");
public void ucsynLogin(long uid, String username, String password, final JSONObject callback) {
BBSUserInfo bbsUserInfo = new BBSUserInfo(username, password);
BBSPluginLogin.getInstance().login(bbsUserInfo);
uiLabel.setText(username);
}
@ -529,21 +529,21 @@ public class PluginWebBridge {
/**
* 初始化设计器部分
*/
public void initExtraDiff(final JSObject callback){
public void initExtraDiff(final JSObject callback) {
}
/**
* 国际化
*/
public String parseI18(final String key){
public String parseI18(final String key) {
return Inter.getLocText(key);
}
/**
* 是否是在设计器中操作
*/
public boolean isDesigner(){
public boolean isDesigner() {
return true;
}

9
designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java

@ -155,7 +155,14 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
leftContentPane.add(toolBarPane, BorderLayout.NORTH);
// 顶部标签及add按钮
topToolBar = new UIToolbar();
topToolBar = new UIToolbar(FlowLayout.LEFT, new UIToolBarUI(){
@Override
public void paint(Graphics g, JComponent c) {
Graphics2D g2 = (Graphics2D) g;
g2.setColor(UIConstants.SELECT_TAB);
g2.fillRect(0, 0, c.getWidth(), c.getHeight());
}
});
topToolBar.setLayout(new BorderLayout());
ShortCut addItem = addItemShortCut().getShortCut();
addItem.intoJToolBar(topToolBar);

7
designer_base/src/com/fr/design/gui/icombobox/UIComboBoxUI.java

@ -57,11 +57,12 @@ public class UIComboBoxUI extends BasicComboBoxUI implements MouseListener {
super.paint(g, c);
Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
Color linecolor = UIConstants.LINE_COLOR;
Color linecolor = UIConstants.TITLED_BORDER_COLOR;
if (comboBox.isPopupVisible()) {
arrowButton.setSelected(true);
} else {
linecolor = UIConstants.LINE_COLOR;
linecolor = UIConstants.TITLED_BORDER_COLOR;
arrowButton.setSelected(false);
}
g2d.setColor(linecolor);
@ -192,7 +193,7 @@ public class UIComboBoxUI extends BasicComboBoxUI implements MouseListener {
@Override
public void paintBorder(Graphics g) {
Graphics2D g2 = (Graphics2D) g;
g2.setColor(UIConstants.LINE_COLOR);
g2.setColor(UIConstants.TITLED_BORDER_COLOR);
g2.drawRoundRect(0, -arrowButton.getHeight(), getWidth() - 1, getHeight() + arrowButton.getHeight() - 1, UIConstants.ARC, UIConstants.ARC);
}

748
designer_base/src/com/fr/design/layout/TableLayoutHelper.java

@ -1,324 +1,426 @@
package com.fr.design.layout;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.general.Inter;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*;
import java.awt.*;
public class TableLayoutHelper {
public static final int FILL_NONE = 0;
public static final int FILL_LASTCOLUMN = 1;
public static final int FILL_LASTROW = 2;
public static final int FILL_LASTCOL_AND_ROW = 3;
private static final int FIVE = 5;
private static final int TEN = 10;
private TableLayoutHelper() {
}
/**
* <p>一个通用的TableLayoutPane生成方法<p>
* <p>rowSize为各行高度之间的比例<p>
* <p>columnSize 为各列宽度之间的比例<p>
* <p>Component[][] components = {<p>
* <p>// column_1 column_2 column_3<p>
* <p> {component11, component12, component13} // row_1<p>
* <p> {component21, component22, component23} // row_2<p>
* <p>}<p>
*/
/**
*最常用的最后一行列fill或者都是prefer的tablelayout
* @param components 组件
* @return
*/
public static JPanel createTableLayoutPane(Component[][] components, int fillType){
return createGapTableLayoutPane(components, fillType, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM);
}
public static JPanel createTableLayoutPane(Component[][] components, double[] rowSize, double[] columnSize) {
return createCommonTableLayoutPane(components, rowSize, columnSize, LayoutConstants.VGAP_MEDIUM);
}
/**
* 标题布局(二级菜单距左边框46)
* @param title 标题
* @param component 组件
* @return 布局好的组件
*/
public static JPanel createTableLayoutPaneWithTitle(String title, Component component){
return createTitlePane(title, component, LayoutConstants.CHART_ATTR_TOMARGIN);
}
public static JPanel createTitlePane(String title, Component component, int gap){
return createTitlePaneWithUILabel(new UILabel(title), component, gap);
}
/**
* 标题布局指定gap
* @param label 标题label
* @param component 组件
* @param gap 距左侧距离
* @return 布局好的组件
*/
public static JPanel createTitlePaneWithUILabel(UILabel label, Component component, int gap){
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {gap, f};
double[] rowSize = {p, p};
Component[][] components = new Component[][]{
new Component[]{label,null},
new Component[]{null,component},
};
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
}
public static JPanel createCommonTableLayoutPane(Component[][] components, double[] rowSize, double[] columnSize, double gap) {
return createGapTableLayoutPane(components, rowSize, columnSize, gap, gap);
}
public static JPanel createGapTableLayoutPane(Component[][] components, int fillType, double horizontalGap, double verticalGap) {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
int maxColCount = 0;
for (int i = 0 ; i < components.length; i ++) {
if (components[i].length > maxColCount) {
maxColCount = components[i].length;
}
}
double[] rowSize = new double[components.length];
for (int i = 0; i < components.length; i ++) {
rowSize[i] = p;
}
double[] columnSize = new double[maxColCount];
for (int i = 0; i < maxColCount; i ++) {
columnSize[i] = p;
}
if (fillType == FILL_LASTCOLUMN && columnSize.length > 0) {
columnSize[columnSize.length - 1] = f;
}
if (fillType == FILL_LASTROW && rowSize.length > 0) {
rowSize[rowSize.length - 1] = f;
}
if (fillType == FILL_LASTCOL_AND_ROW ) {
if (columnSize.length > 0) {
columnSize[columnSize.length - 1] = f;
}
if (rowSize.length > 0) {
rowSize[rowSize.length - 1] = f;
}
}
return createGapTableLayoutPane(components, rowSize, columnSize, horizontalGap, verticalGap);
}
public static JPanel createGapTableLayoutPane(Component[][] components,
double[] rowSize, double[] columnSize, double horizontalGap, double verticalGap) {
JPanel resultPane = setPanelLayout(rowSize, columnSize, horizontalGap, verticalGap);
for (int i = 0; i < components.length; i++) {
if (i >= rowSize.length) {
break;
}
Component[] rowComponents = components[i];
for (int j = 0; j < rowComponents.length && j < columnSize.length; j++) {
if (rowComponents[j] == null) {
continue;
}
if (isNextAllNull(rowComponents, j + 1)) {
resultPane.add(rowComponents[j], (2 * j + 1) + "," + (2 * i + 1) + "," + (2 * rowComponents.length - 1) + ",0");
} else {
resultPane.add(rowComponents[j], (2 * j + 1) + "," + (2 * i + 1));
}
}
}
return resultPane;
}
public static JPanel createGapTableLayoutPane(Component[][] components,
double[] rowSize, double[] columnSize, int rowCount[][], double horizontalGap, double verticalGap) {
JPanel resultPane = setPanelLayout(rowSize, columnSize, horizontalGap, verticalGap);
int k = components.length;
int[] row = new int[k]; //存放每组控件在第几行开始
int sumRow = 1; //存放一次递增的行的数目
for (int i = 0; i < components.length; i++) {
row[i] = sumRow;
int maxRowCount = 1;
if (i >= rowSize.length) {
break;
}
Component[] rowComponents = components[i];
for (int j = 0; j < rowComponents.length && j < columnSize.length; j++) {
if (rowComponents[j] == null) {
continue;
}
if (isNextAllNull(rowComponents, j + 1)) {
if (rowCount[i][j] != 1) {
resultPane.add(rowComponents[j], (2 * j + 1) + "," + row[i] + "," + (2 * rowComponents.length - 1) + "," + (row[i] + rowCount[i][j] - 1));
if (rowCount[i][j] > maxRowCount) {
maxRowCount = rowCount[i][j];
}
} else {
resultPane.add(rowComponents[j], (2 * j + 1) + "," + row[i] + "," + (2 * rowComponents.length - 1) + "," + row[i]);
}
} else {
if (rowCount[i][j] != 1) {
resultPane.add(rowComponents[j], (2 * j + 1) + "," + row[i] + "," + (2 * j + 1) + "," + (row[i] + rowCount[i][j] - 1));
if (rowCount[i][j] > maxRowCount) {
maxRowCount = rowCount[i][j];
}
} else {
resultPane.add(rowComponents[j], (2 * j + 1) + "," + row[i]);
}
}
}
sumRow = row[i] + maxRowCount + 1;
}
return resultPane;
}
private static boolean isNextAllNull(Component[] rowComponents, int currentIndex) {
for (int i = currentIndex; i < rowComponents.length; i++) {
if (rowComponents[i] != null) {
return false;
}
}
return true;
}
private static JPanel setPanelLayout(double[] rowSize, double[] columnSize, double horizontalGap, double verticalGap) {
double layoutSize[][] = new double[2][];
double layoutColumnSize[] = new double[2 * columnSize.length];
double layoutRowSize[] = new double[2 * rowSize.length];
for (int i = 0; i < columnSize.length; i++) {
if (i == 0) {
layoutColumnSize[i * 2] = 0;
} else {
layoutColumnSize[i * 2] = horizontalGap;
}
layoutColumnSize[i * 2 + 1] = columnSize[i];
}
for (int i = 0; i < rowSize.length; i++) {
if (i == 0) {
layoutRowSize[i * 2] = 0;
} else {
layoutRowSize[i * 2] = verticalGap;
}
layoutRowSize[i * 2 + 1] = rowSize[i];
}
layoutSize[0] = layoutColumnSize;
layoutSize[1] = layoutRowSize;
JPanel resultPane = new JPanel();
resultPane.setLayout(new TableLayout(layoutSize));
return resultPane;
}
/**
* 图表属性表用的比较多的一种布局第一行是title,下面的components相当于二级菜单
* 二级菜单和上层面板的间距在layoutconstants里定义
* @param title
* @param components 二级菜单的内容
* @param rowSize 二级菜单的行数
* @param columnSize 二级菜单的列数
* @return
*/
public static JPanel createTableLayoutPane4Chart(String[] title, Component[][] components, double[] rowSize, double[] columnSize){
JPanel secondMenu = createTableLayoutPane(components, rowSize, columnSize);
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] column = {LayoutConstants.CHART_ATTR_TOMARGIN, f};
double[] row = { p,p};
Component[][] comp = new Component[][]{
new Component[]{new UILabel(Inter.getLocText(title)), null},
new Component[]{null, secondMenu},
};
return createTableLayoutPane(comp, row, column);
}
public static void main (String[] args) {
JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel) jf.getContentPane();
content.setLayout(new GridLayout(2,2));
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
JPanel jp1 = TableLayoutHelper.createTableLayoutPane(createTestComponents("jp1"), TableLayoutHelper.FILL_NONE);
JPanel jp2 = TableLayoutHelper.createGapTableLayoutPane(createTestComponents("jp2"), TableLayoutHelper.FILL_LASTCOL_AND_ROW, 2 * TEN, 2 * TEN);
JPanel jp3 = TableLayoutHelper.createGapTableLayoutPane(createTestComponents("jp3"),
new double[] {f,p,f,p}, new double[] {f,f}, 4,4);
JPanel jp4 = TableLayoutHelper.createGapTableLayoutPane(createTestComponents("jp4"),
new double[] {p,FIVE * TEN,p,p,p,p},new double[] {p, f}, new int[][] {{1,3},{1,1},{1,1},{1,1},{1,1}}, 1, FIVE);
jp1.setBorder(BorderFactory.createLineBorder(Color.red));
jp2.setBorder(BorderFactory.createLineBorder(Color.red));
jp3.setBorder(BorderFactory.createLineBorder(Color.red));
jp4.setBorder(BorderFactory.createLineBorder(Color.red));
content.add(jp1);
content.add(jp2);
content.add(jp3);
content.add(jp4);
GUICoreUtils.centerWindow(jf);
jf.setSize(600, 600);
jf.setVisible(true);
}
private static Component[][] createTestComponents (String name ) {
UILabel label1 = new UILabel(name + "laaaable1");
UILabel label2 = new UILabel(name + "lable2");
UILabel label3 = new UILabel(name + "lable3");
UILabel label4 = new UILabel(name + "lable4");
UILabel label5 = new UILabel(name + "lable5");
UIButton button1 = new UIButton(name + "button1");
UIButton button2 = new UIButton(name + "button2");
label1.setSize(label1.getPreferredSize());
label1.setBorder(BorderFactory.createLineBorder(Color.blue));
label2.setSize(label2.getPreferredSize());
label2.setBorder(BorderFactory.createLineBorder(Color.blue));
label3.setSize(label3.getPreferredSize());
label3.setBorder(BorderFactory.createLineBorder(Color.blue));
label4.setSize(label4.getPreferredSize());
label4.setBorder(BorderFactory.createLineBorder(Color.blue));
label5.setSize(label5.getPreferredSize());
label5.setBorder(BorderFactory.createLineBorder(Color.blue));
button1.setSize(button1.getPreferredSize());
button2.setSize(button2.getPreferredSize());
button1.setBackground(Color.darkGray);
button2.setBackground(Color.darkGray);
Component[][] components = new Component[][] {
new Component[] {label1, button1},
new Component[] {label2, null},
new Component[] {label3},
new Component[] {null,label4},
new Component[] {button2, label5}
} ;
return components;
}
package com.fr.design.layout;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
public class TableLayoutHelper {
public static final int FILL_NONE = 0;
public static final int FILL_LASTCOLUMN = 1;
public static final int FILL_LASTROW = 2;
public static final int FILL_LASTCOL_AND_ROW = 3;
private static final int FIVE = 5;
private static final int TEN = 10;
private TableLayoutHelper() {
}
/**
* <p>一个通用的TableLayoutPane生成方法<p>
* <p>rowSize为各行高度之间的比例<p>
* <p>columnSize 为各列宽度之间的比例<p>
* <p>Component[][] components = {<p>
* <p>// column_1 column_2 column_3<p>
* <p> {component11, component12, component13} // row_1<p>
* <p> {component21, component22, component23} // row_2<p>
* <p>}<p>
*/
/**
* 最常用的最后一行列fill或者都是prefer的tablelayout
*
* @param components 组件
* @return
*/
public static JPanel createTableLayoutPane(Component[][] components, int fillType) {
return createGapTableLayoutPane(components, fillType, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM);
}
public static JPanel createTableLayoutPane(Component[][] components, double[] rowSize, double[] columnSize) {
return createCommonTableLayoutPane(components, rowSize, columnSize, LayoutConstants.VGAP_MEDIUM);
}
/**
* 标题布局(二级菜单距左边框46)
*
* @param title 标题
* @param component 组件
* @return 布局好的组件
*/
public static JPanel createTableLayoutPaneWithTitle(String title, Component component) {
return createTitlePane(title, component, LayoutConstants.CHART_ATTR_TOMARGIN);
}
public static JPanel createTitlePane(String title, Component component, int gap) {
return createTitlePaneWithUILabel(new UILabel(title), component, gap);
}
/**
* 标题布局指定gap
*
* @param label 标题label
* @param component 组件
* @param gap 距左侧距离
* @return 布局好的组件
*/
public static JPanel createTitlePaneWithUILabel(UILabel label, Component component, int gap) {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {gap, f};
double[] rowSize = {p, p};
Component[][] components = new Component[][]{
new Component[]{label, null},
new Component[]{null, component},
};
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
}
public static JPanel createCommonTableLayoutPane(Component[][] components, double[] rowSize, double[] columnSize, double gap) {
return createGapTableLayoutPane(components, rowSize, columnSize, gap, gap);
}
public static JPanel createGapTableLayoutPane(Component[][] components, int fillType, double horizontalGap, double verticalGap) {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
int maxColCount = 0;
for (int i = 0; i < components.length; i++) {
if (components[i].length > maxColCount) {
maxColCount = components[i].length;
}
}
double[] rowSize = new double[components.length];
for (int i = 0; i < components.length; i++) {
rowSize[i] = p;
}
double[] columnSize = new double[maxColCount];
for (int i = 0; i < maxColCount; i++) {
columnSize[i] = p;
}
if (fillType == FILL_LASTCOLUMN && columnSize.length > 0) {
columnSize[columnSize.length - 1] = f;
}
if (fillType == FILL_LASTROW && rowSize.length > 0) {
rowSize[rowSize.length - 1] = f;
}
if (fillType == FILL_LASTCOL_AND_ROW) {
if (columnSize.length > 0) {
columnSize[columnSize.length - 1] = f;
}
if (rowSize.length > 0) {
rowSize[rowSize.length - 1] = f;
}
}
return createGapTableLayoutPane(components, rowSize, columnSize, horizontalGap, verticalGap);
}
public static JPanel createGapTableLayoutPane(Component[][] components,
double[] rowSize,
double[] columnSize,
double horizontalGap,
double verticalGap) {
JPanel resultPane = setPanelLayout(rowSize, columnSize, horizontalGap, verticalGap);
addComponent2ResultPane(components, rowSize, columnSize, resultPane);
return resultPane;
}
public static JPanel createDiffVGapTableLayoutPane(Component[][] components,
double[] rowSize,
double[] columnSize,
double horizontalGap,
double[] verticalGap) {
JPanel resultPane = setPanelLayout(rowSize, columnSize, horizontalGap, verticalGap);
addComponent2ResultPane(components, rowSize, columnSize, resultPane);
return resultPane;
}
public static JPanel createGapTableLayoutPane(Component[][] components,
double[] rowSize, double[] columnSize, int rowCount[][], double horizontalGap, double verticalGap) {
JPanel resultPane = setPanelLayout(rowSize, columnSize, horizontalGap, verticalGap);
int k = components.length;
int[] row = new int[k]; //存放每组控件在第几行开始
int sumRow = 1; //存放一次递增的行的数目
for (int i = 0; i < components.length; i++) {
row[i] = sumRow;
int maxRowCount = 1;
if (i >= rowSize.length) {
break;
}
Component[] rowComponents = components[i];
for (int j = 0; j < rowComponents.length && j < columnSize.length; j++) {
if (rowComponents[j] == null) {
continue;
}
if (isNextAllNull(rowComponents, j + 1)) {
if (rowCount[i][j] != 1) {
resultPane.add(rowComponents[j], (2 * j + 1) + "," + row[i] + "," + (2 * rowComponents.length - 1) + "," + (row[i] + rowCount[i][j] - 1));
if (rowCount[i][j] > maxRowCount) {
maxRowCount = rowCount[i][j];
}
} else {
resultPane.add(rowComponents[j], (2 * j + 1) + "," + row[i] + "," + (2 * rowComponents.length - 1) + "," + row[i]);
}
} else {
if (rowCount[i][j] != 1) {
resultPane.add(rowComponents[j], (2 * j + 1) + "," + row[i] + "," + (2 * j + 1) + "," + (row[i] + rowCount[i][j] - 1));
if (rowCount[i][j] > maxRowCount) {
maxRowCount = rowCount[i][j];
}
} else {
resultPane.add(rowComponents[j], (2 * j + 1) + "," + row[i]);
}
}
}
sumRow = row[i] + maxRowCount + 1;
}
return resultPane;
}
/**
* 修改TableLayout布局的容器指定位置垂直间距的大小
*
* @param container 容器
* @param index vgap的索引ContainervGapA[ComponentA]vGapB[ComponentB]vGapC,vGapB index=2,
* 详情见{@link TableLayout#setRow(int, double)}
* @param vgap vgap的新值
*/
public static void modifyTableLayoutIndexVGap(Container container, int index, double vgap) {
TableLayout layout = (TableLayout) container.getLayout();
layout.setRow(index, vgap);
layout.layoutContainer(container);
container.repaint();
}
/**
* 修改TableLayout布局的容器指定位置水平间距的大小
*
* @param container 容器
* @param index hgap的索引ContainerhGapA[ComponentA]hGapB[ComponentB],hGapB index=2,
* 详情见{@link TableLayout#setColumn(int, double)}
* @param hgap hgap的新值
*/
public static void modifyTableLayoutIndexHGap(Container container, int index, double hgap) {
TableLayout layout = (TableLayout) container.getLayout();
layout.setColumn(index, hgap);
layout.layoutContainer(container);
container.repaint();
}
private static void addComponent2ResultPane(Component[][] components, double[] rowSize, double[] columnSize, JPanel resultPane) {
for (int i = 0; i < components.length; i++) {
if (i >= rowSize.length) {
break;
}
Component[] rowComponents = components[i];
for (int j = 0; j < rowComponents.length && j < columnSize.length; j++) {
if (rowComponents[j] == null) {
continue;
}
if (isNextAllNull(rowComponents, j + 1)) {
resultPane.add(rowComponents[j], (2 * j + 1) + "," + (2 * i + 1) + "," + (2 * rowComponents.length - 1) + ",0");
} else {
resultPane.add(rowComponents[j], (2 * j + 1) + "," + (2 * i + 1));
}
}
}
}
private static boolean isNextAllNull(Component[] rowComponents, int currentIndex) {
for (int i = currentIndex; i < rowComponents.length; i++) {
if (rowComponents[i] != null) {
return false;
}
}
return true;
}
private static JPanel setPanelLayout(double[] rowSize, double[] columnSize, double horizontalGap, double verticalGap) {
double layoutSize[][] = new double[2][];
double layoutColumnSize[] = new double[2 * columnSize.length];
double layoutRowSize[] = new double[2 * rowSize.length];
for (int i = 0; i < columnSize.length; i++) {
if (i == 0) {
layoutColumnSize[i * 2] = 0;
} else {
layoutColumnSize[i * 2] = horizontalGap;
}
layoutColumnSize[i * 2 + 1] = columnSize[i];
}
for (int i = 0; i < rowSize.length; i++) {
if (i == 0) {
layoutRowSize[i * 2] = 0;
} else {
layoutRowSize[i * 2] = verticalGap;
}
layoutRowSize[i * 2 + 1] = rowSize[i];
}
layoutSize[0] = layoutColumnSize;
layoutSize[1] = layoutRowSize;
JPanel resultPane = new JPanel();
resultPane.setLayout(new TableLayout(layoutSize));
return resultPane;
}
/**
* 创建具有不同垂直间距的TableLayout面板
*
* @param rowSize
* @param columnSize
* @param horizontalGap 水平间距
* @param verticalGap 不同的垂直间距
* @return JPanel 具有不同垂直间距的TableLayout面板
*/
private static JPanel setPanelLayout(double[] rowSize, double[] columnSize, double horizontalGap, double[] verticalGap) {
double layoutSize[][] = new double[2][];
double layoutColumnSize[] = new double[2 * columnSize.length];
double layoutRowSize[] = new double[2 * rowSize.length];
for (int i = 0; i < columnSize.length; i++) {
if (i == 0) {
layoutColumnSize[i * 2] = 0;
} else {
layoutColumnSize[i * 2] = horizontalGap;
}
layoutColumnSize[i * 2 + 1] = columnSize[i];
}
for (int i = 0; i < rowSize.length; i++) {
if (i == 0) {
layoutRowSize[i * 2] = 0;
} else {
layoutRowSize[i * 2] = verticalGap[i - 1];
}
layoutRowSize[i * 2 + 1] = rowSize[i];
}
layoutSize[0] = layoutColumnSize;
layoutSize[1] = layoutRowSize;
JPanel resultPane = new JPanel();
resultPane.setLayout(new TableLayout(layoutSize));
return resultPane;
}
/**
* 图表属性表用的比较多的一种布局第一行是title,下面的components相当于二级菜单
* 二级菜单和上层面板的间距在layoutconstants里定义
*
* @param title
* @param components 二级菜单的内容
* @param rowSize 二级菜单的行数
* @param columnSize 二级菜单的列数
* @return
*/
public static JPanel createTableLayoutPane4Chart(String[] title, Component[][] components, double[] rowSize, double[] columnSize) {
JPanel secondMenu = createTableLayoutPane(components, rowSize, columnSize);
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] column = {LayoutConstants.CHART_ATTR_TOMARGIN, f};
double[] row = {p, p};
Component[][] comp = new Component[][]{
new Component[]{new UILabel(Inter.getLocText(title)), null},
new Component[]{null, secondMenu},
};
return createTableLayoutPane(comp, row, column);
}
public static void main(String[] args) {
JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
JPanel content = (JPanel) jf.getContentPane();
content.setLayout(new GridLayout(2, 3));
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
JPanel jp1 = TableLayoutHelper.createTableLayoutPane(createTestComponents("jp1"), TableLayoutHelper.FILL_NONE);
JPanel jp2 = TableLayoutHelper.createGapTableLayoutPane(createTestComponents("jp2"), TableLayoutHelper.FILL_LASTCOL_AND_ROW, 2 * TEN, 2 * TEN);
JPanel jp3 = TableLayoutHelper.createGapTableLayoutPane(createTestComponents("jp3"),
new double[]{f, p, f, p}, new double[]{f, f}, 4, 4);
JPanel jp4 = TableLayoutHelper.createGapTableLayoutPane(createTestComponents("jp4"),
new double[]{p, FIVE * TEN, p, p, p, p}, new double[]{p, f}, new int[][]{{1, 3}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}, 1, FIVE);
JPanel jp5 = TableLayoutHelper.createDiffVGapTableLayoutPane(createTestComponents("jp5"),
new double[]{p, p, p, p, p}, new double[]{p, f}, 4, new double[]{4, 8, 14, 4});
JPanel jp6 = new JPanel();
jp1.setBorder(BorderFactory.createLineBorder(Color.red));
jp2.setBorder(BorderFactory.createLineBorder(Color.red));
jp3.setBorder(BorderFactory.createLineBorder(Color.red));
jp4.setBorder(BorderFactory.createLineBorder(Color.red));
jp5.setBorder(BorderFactory.createLineBorder(Color.red));
jp6.setBorder(BorderFactory.createLineBorder(Color.red));
content.add(jp1);
content.add(jp2);
content.add(jp3);
content.add(jp4);
content.add(jp5);
content.add(jp6);
GUICoreUtils.centerWindow(jf);
jf.setSize(900, 600);
jf.setVisible(true);
}
private static Component[][] createTestComponents(String name) {
UILabel label1 = new UILabel(name + "laaaable1");
UILabel label2 = new UILabel(name + "lable2");
UILabel label3 = new UILabel(name + "lable3");
UILabel label4 = new UILabel(name + "lable4");
UILabel label5 = new UILabel(name + "lable5");
UIButton button1 = new UIButton(name + "button1");
UIButton button2 = new UIButton(name + "button2");
label1.setSize(label1.getPreferredSize());
label1.setBorder(BorderFactory.createLineBorder(Color.blue));
label2.setSize(label2.getPreferredSize());
label2.setBorder(BorderFactory.createLineBorder(Color.blue));
label3.setSize(label3.getPreferredSize());
label3.setBorder(BorderFactory.createLineBorder(Color.blue));
label4.setSize(label4.getPreferredSize());
label4.setBorder(BorderFactory.createLineBorder(Color.blue));
label5.setSize(label5.getPreferredSize());
label5.setBorder(BorderFactory.createLineBorder(Color.blue));
button1.setSize(button1.getPreferredSize());
button2.setSize(button2.getPreferredSize());
button1.setBackground(Color.darkGray);
button2.setBackground(Color.darkGray);
return new Component[][]{
new Component[]{label1, button1},
new Component[]{label2, null},
new Component[]{label3},
new Component[]{null, label4},
new Component[]{button2, label5}
};
}
}

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

@ -2123,4 +2123,6 @@ FR-Designer_Coords_And_Size=Coords & Size
FR-Designer_Barcode_Size=Barcode_Size
FS-Designer_DS_Filter_Odd_Tip=Odd_Tip
FS-Designer_DS_Filter_Even_Tip=Even_Tip
FS-Designer_DS_Filter_Specify_Tip=Specify_Tip
FS-Designer_DS_Filter_Specify_Tip=Specify_Tip
FR-Designer_Mobile-Height-Percent=Max Percent
FR-Designer_Mobile-Height-Limit=Height Limit

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

@ -424,6 +424,8 @@ FR-Designer-App_ReLayout=AppRelayout
FR-Designer_Mobile-Attr=Mobile Attr
FR-Designer_Mobile-Vertical=Vertical Screen
FR-Designer_Mobile-Horizontal=Horizontal Screen
FR-Designer_Mobile-Height-Percent=Max Percent
FR-Designer_Mobile-Height-Limit=Height Limit
FR-Designer_COMMUNITY=community
FR-Designer_COMMUNITY_BBS=bbs
FR-Designer_COMMUNITY_VIDEO=video

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

@ -1357,7 +1357,7 @@ RWA-NotChange_Unmodified=\u306E\u6539\u6B63\u3092\u66F4\u65B0\u3057\u306A\u3044
User_Information=\u30E6\u30FC\u30B6\u30FC\u60C5\u5831
Custom_styles_lost=\u30AB\u30B9\u30BF\u30DE\u30A4\u30BA\u30B9\u30BF\u30A4\u30EB\u306F\u5931\u308F\u308C\u307E\u3057\u305F
PageSetup-Margin=\u4F59\u767D
M-New_FormBook=\
M-New_FormBook=
Widget-TreeNode=\u30C4\u30EA\u30FC\u30CE\u30FC\u30C9\u30DC\u30BF\u30F3
Form-Url=\u30A2\u30C9\u30EC\u30B9
Utils-Beyond_the_left_side_of_Border=\u5DE6\u30DC\u30FC\u30C0\u30FC\u8D85\u3048
@ -1981,7 +1981,6 @@ FR-Base_UnSignIn=\ \u672A\u30ED\u30B0\u30A4\u30F3
Every=\u6BCE
CellWrite-Preview_Cell_Content=\u30BB\u30EB\u5185\u5BB9
FormulaD-Data_Fields=\u30C7\u30FC\u30BF\u30D5\u30A3\u30FC\u30EB\u30C9
FormulaD-Data_Fields=\u30C7\u30FC\u30BF\u30D5\u30A3\u30FC\u30EB\u30C9
FR-Designer_Permissions=\u6A29\u9650
FR-Designer_Form_Button=\u30DC\u30BF\u30F3
FR-Designer_WF_Name=\u540D
@ -2004,8 +2003,6 @@ FR-Designer_Data_Filter=\u30C7\u30FC\u30BF\u30D5\u30A3\u30EB\u30BF
FR-Designer_Can_not_use_FormatBursh=\u9023\u7D9A\u3057\u306A\u3044\u8907\u6570\u9818\u57DF\u3067\u306F\u66F8\u5F0F\u30B3\u30D4\u30FC\u3092\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093
Default=\u65E2\u5B9A
FR-Base-Load_Resource_File=\u8A2D\u5B9A\u30D5\u30A1\u30A4\u30EB\u30ED\u30FC\u30C9
FormulaD-Data_Fields=\u30C7\u30FC\u30BF\u30D5\u30A3\u30FC\u30EB\u30C9
FR-Designer_Cell_Element=\u30BB\u30EB\u8981\u7D20
FR-Designer_Cell_Attributes=\u30BB\u30EB\u5C5E\u6027
FR-Designer_Float_Element=\u30D5\u30ED\u30FC\u30C8\u8981\u7D20
@ -2122,3 +2119,5 @@ FR-Designer_Barcode_Size=
FS-Designer_DS_Filter_Odd_Tip=
FS-Designer_DS_Filter_Even_Tip=
FS-Designer_DS_Filter_Specify_Tip=
FR-Designer_Mobile-Height-Percent=
FR-Designer_Mobile-Height-Limit=

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

@ -1982,7 +1982,6 @@ FR-Base_UnSignIn=\uC544\uC9C1 \uB4F1\uB85D
Every=\uAC01
CellWrite-Preview_Cell_Content=\uC140\uB0B4\uC6A9\uBBF8\uB9AC\uBCF4\uAE30
FormulaD-Data_Fields=\uB370\uC774\uD130\uD56D\uBAA9
FormulaD-Data_Fields=\uB370\uC774\uD130\uD56D\uBAA9
FR-Designer_Permissions=
FR-Designer_Form_Button=
FR-Designer_WF_Name=
@ -1995,7 +1994,6 @@ FR-Designer_Parameter=\uB9E4\uAC1C\uBCC0\uC218
FR-Designer-Plugin_Plugin=\uD50C\uB7EC\uADF8\uC778
FR-Designer_Background=\uBC30\uACBD
Template=\uD15C\uD50C\uB9BF
FR-Designer_Double=\uC18C\uC218
FR-Designer_Original_Marked_Filed=\uCD08\uAE30\uD0DC\uADF8\uD544\uB4DC
FR-Designer_Build_Tree_Accord_Marked_Filed_Length=\uC120\uD0DD\uD55C\uB370\uC774\uD130\uC138\uD2B8\uC758\uD0DC\uADF8\uD544\uB4DC\uAE38\uC774\uC5D0\uB530\uB77C\uD2B8\uB9AC\uC0DD\uC131
FR-Designer_Tree_Data_Field=\uD2B8\uB9AC\uB370\uC774\uD130\uD544\uB4DC
@ -2005,7 +2003,6 @@ FR-Product_Demo=\uC81C\uD488\uC2DC\uC5F0
FR-Designer_Data_Filter=\uB370\uC774\uD130\uC120\uBCC4
Default=\uAE30\uBCF8
FR-Base-Load_Resource_File=\uB85C\uB529\uAD6C\uC131\uD30C\uC77C
FormulaD-Data_Fields=\uB370\uC774\uD130\uD56D\uBAA9
FR-Designer_Cell_Element=\uC140\uC694\uC18C
FR-Designer_Cell_Attributes=\uC140\uC18D\uC131
FR-Designer_Float_Element=\uD638\uBC84\uC694\uC18C
@ -2122,4 +2119,6 @@ FR-Designer_Coords_And_Size=
FR-Designer_Barcode_Size=
FS-Designer_DS_Filter_Odd_Tip=
FS-Designer_DS_Filter_Even_Tip=
FS-Designer_DS_Filter_Specify_Tip=
FS-Designer_DS_Filter_Specify_Tip=
FR-Designer_Mobile-Height-Percent=
FR-Designer_Mobile-Height-Limit=

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

@ -426,6 +426,8 @@ FR-Designer-App_ReLayout=\u624B\u673A\u91CD\u5E03\u5C40
FR-Designer_Mobile-Attr=\u79FB\u52A8\u7AEF\u5C5E\u6027
FR-Designer_Mobile-Vertical=\u7AD6\u5C4F
FR-Designer_Mobile-Horizontal=\u6A2A\u5C4F
FR-Designer_Mobile-Height-Limit=\u624B\u673A\u663E\u793A\u9650\u5236\u9AD8\u5EA6
FR-Designer_Mobile-Height-Percent=\u6700\u5927\u9AD8\u5EA6
FR-Designer_COMMUNITY=\u793E\u533A
FR-Designer_COMMUNITY_BBS=\u5E06\u8F6F\u8BBA\u575B
FR-Designer_COMMUNITY_VIDEO=\u5165\u95E8\u89C6\u9891

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

@ -424,6 +424,8 @@ FR-Designer-App_ReLayout=\u624B\u6A5F\u91CD\u4F48\u5C40
FR-Designer_Mobile-Attr=\u79FB\u52D5\u7AEF\u5C6C\u6027
FR-Designer_Mobile-Horizontal=\u6A6B\u5C4F
FR-Designer_Mobile-Vertical=\u8C4E\u5C4F
FR-Designer_Mobile-Height-Limit=\u624B\u6A5F\u986F\u793A\u9650\u5236\u9AD8\u5EA6
FR-Designer_Mobile-Height-Percent=\u6700\u5927\u9AD8\u5EA6
FR-Designer_COMMUNITY_QUESTIONS=\u554F\u984C\u6C42\u52A9
FR-Designer_COMMUNITY_SIGN=\u5E06\u8EDF\u8A8D\u8B49
FR-Designer_COMMUNITY_BUG=BUG\u53CD\u994B

22
designer_base/src/com/fr/design/mainframe/JSliderPane.java

@ -91,7 +91,6 @@ public class JSliderPane extends JPanel {
}
public static final JSliderPane getInstance() {
// if (THIS == null) {
// THIS = new JSliderPane();
@ -101,8 +100,8 @@ public class JSliderPane extends JPanel {
}
private void initSlider() {
slider = new UISlider(0, HUNDRED, HALF_HUNDRED){
public Point getToolTipLocation(MouseEvent event){
slider = new UISlider(0, HUNDRED, HALF_HUNDRED) {
public Point getToolTipLocation(MouseEvent event) {
return new Point(event.getX(), event.getY() - TOOLTIP_Y);
}
};
@ -115,8 +114,8 @@ public class JSliderPane extends JPanel {
}
private void initShowValSpinner() {
showValSpinner = new UIBasicSpinner(new SpinnerNumberModel(HUNDRED, TEN, FOUR_HUNDRED, 1)){
public Point getToolTipLocation(MouseEvent event){
showValSpinner = new UIBasicSpinner(new SpinnerNumberModel(HUNDRED, TEN, FOUR_HUNDRED, 1)) {
public Point getToolTipLocation(MouseEvent event) {
return new Point(event.getX(), event.getY() - TOOLTIP_Y);
}
};
@ -126,16 +125,16 @@ public class JSliderPane extends JPanel {
}
private void initDownUpButton() {
downButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/normalDown20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverDown20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverDown20.png")){
public Point getToolTipLocation(MouseEvent event){
downButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/normalDown20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverDown20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverDown20.png")) {
public Point getToolTipLocation(MouseEvent event) {
return new Point(event.getX(), event.getY() - TOOLTIP_Y);
}
};
downButton.setOpaque(false);
downButton.setBorderPainted(false);
downButton.setToolTipText(Inter.getLocText("FR-Designer_Scale_Down"));
upButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/normalUp20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverUp20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverUp20.png")){
public Point getToolTipLocation(MouseEvent event){
upButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/normalUp20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverUp20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverUp20.png")) {
public Point getToolTipLocation(MouseEvent event) {
return new Point(event.getX(), event.getY() - TOOLTIP_Y);
}
};
@ -149,8 +148,8 @@ public class JSliderPane extends JPanel {
}
private void initShowValButton() {
showValButton = new JButton(showValSpinner.getValue() + "%"){
public Point getToolTipLocation(MouseEvent event){
showValButton = new JButton(showValSpinner.getValue() + "%") {
public Point getToolTipLocation(MouseEvent event) {
return new Point(event.getX(), event.getY() - TOOLTIP_Y);
}
};
@ -278,6 +277,7 @@ public class JSliderPane extends JPanel {
getTimes(sliderValue);
showValue = times;
showValSpinner.setValue(times);
customButton.setSelected(true);
}
});
} else {

40
designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java

@ -122,6 +122,9 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetPrope
extraPane.initPropertyGroups(designer);
}
}
// for (AbstractPropertyTable propertyTable : widgetPropertyTables) {
// propertyTable.initPropertyGroups(designer);
// }
}
/**
@ -220,9 +223,14 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetPrope
MobileWidgetDefinePane extraPane = (MobileWidgetDefinePane) widgetAttrProvider.createWidgetAttrPane();
if (extraPane != null) {
mobileExtraPropertyPanes.add(extraPane);
designer.addDesignerEditListener(new WidgetPropertyDesignerAdapter(formWidgetCardPane));
wsp.add(extraPane);
}
// AbstractPropertyTable propertyTable = widgetAttrProvider.createWidgetAttrTable();
// widgetPropertyTables.add(propertyTable);
// designer.addDesignerEditListener(new WidgetPropertyDesignerAdapter(formWidgetCardPane));
//
// UIScrollPane uiScrollPane = new UIScrollPane(getExtraBodyTable(propertyTable));
// wsp.add(uiScrollPane);
}
}
}
@ -379,19 +387,25 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetPrope
|| evt.getCreatorEventID() == DesignerEvent.CREATOR_EDITED
|| evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED
|| evt.getCreatorEventID() == DesignerEvent.CREATOR_ADDED) {
int value = downPanel.getVerticalScrollBar().getValue();
if (hasSelectParaPane(getEditingFormDesigner())) {
cardLayout.show(centerPane, PARA);
mobileParaWidgetTable.refreshData();
} else {
cardLayout.show(centerPane, BODY);
mobileWidgetTable.refreshData();
//fanglei:下面的注释不要删,只是暂时屏蔽
// int value = downPanel.getVerticalScrollBar().getValue();
// if (hasSelectParaPane(getEditingFormDesigner())) {
// cardLayout.show(centerPane, PARA);
// mobileParaWidgetTable.refreshData();
// } else {
// cardLayout.show(centerPane, BODY);
// mobileWidgetTable.refreshData();
// }
// //出现滚动条
// downPanel.doLayout();
// //控件列表选中某组件,触发表单中选中控件,选中事件又触发列表刷新,滚动条回到0
// //此处设置滚动条值为刷新前
// downPanel.getVerticalScrollBar().setValue(value);
if (mobileExtraPropertyPanes != null) {
for (MobileWidgetDefinePane extraPane : mobileExtraPropertyPanes) {
extraPane.populate(designer);
}
}
//出现滚动条
downPanel.doLayout();
//控件列表选中某组件,触发表单中选中控件,选中事件又触发列表刷新,滚动条回到0
//此处设置滚动条值为刷新前
downPanel.getVerticalScrollBar().setValue(value);
}
}
}

101
designer_form/src/com/fr/design/widget/ui/designer/mobile/ElementCaseDefinePane.java

@ -4,6 +4,7 @@ import com.fr.base.mobile.MobileFitAttrState;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
@ -11,19 +12,14 @@ import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.form.ui.ElementCaseEditor;
import com.fr.general.Inter;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
/**
* 报表块-移动端属性面板
@ -45,13 +41,27 @@ public class ElementCaseDefinePane extends MobileWidgetDefinePane{
private UICheckBox heightRestrictCheckBox; // 手机显示限制高度复选框
private UILabel maxHeightLabel;
private UISpinner maxHeightSpinner; // 最大高度Spinner
private AttributeChangeListener changeListener;
public ElementCaseDefinePane (XCreator xCreator) {
this.xCreator = xCreator;
}
@Override
protected String title4PopupWindow() {
protected void initContentPane() {}
@Override
protected JPanel createContentPane() {
return null;
}
@Override
public String getIconPath() {
return "";
}
@Override
public String title4PopupWindow() {
return "ElementCase";
}
@ -62,8 +72,8 @@ public class ElementCaseDefinePane extends MobileWidgetDefinePane{
this.designer = WidgetPropertyPane.getInstance().getEditingFormDesigner();
this.hComboBox = new UIComboBox(ITEMS);
this.vComboBox = new UIComboBox(ITEMS);
this.heightRestrictCheckBox = new UICheckBox(Inter.getLocText("Form-EC_heightrestrict"));
this.maxHeightLabel = new UILabel(Inter.getLocText("Form-EC_heightpercent"), SwingConstants.LEFT);
this.heightRestrictCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Mobile-Height-Limit"));
this.maxHeightLabel = new UILabel(Inter.getLocText("FR-Designer_Mobile-Height-Percent"), SwingConstants.LEFT);
this.maxHeightSpinner = new UISpinner(0, 1, 0.01, 0.75);
maxHeightSpinner.setVisible(false);
maxHeightLabel.setVisible(false);
@ -86,39 +96,68 @@ public class ElementCaseDefinePane extends MobileWidgetDefinePane{
UIExpandablePane folderPane = new UIExpandablePane(Inter.getLocText("FR-Designer_Fit"), 280, 20, panelWrapper);
this.add(folderPane, BorderLayout.NORTH);
this.bingListeners2Widgets();
this.setGlobalNames();
this.repaint();
}
public void bingListeners2Widgets() {
this.hComboBox.addActionListener(new ActionListener() {
private void bingListeners2Widgets() {
reInitAllListeners();
this.changeListener = new AttributeChangeListener() {
@Override
public void actionPerformed(ActionEvent e) {
((ElementCaseEditor)xCreator.toData()).setHorziontalAttr(MobileFitAttrState.parse(hComboBox.getSelectedIndex() + 1));
public void attributeChange() {
update();
}
});
};
}
this.vComboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
((ElementCaseEditor)xCreator.toData()).setVerticalAttr(MobileFitAttrState.parse(vComboBox.getSelectedIndex() + 1));
}
});
/**
* 后台初始化所有事件.
*/
private void reInitAllListeners() {
initListener(this);
}
this.heightRestrictCheckBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
@Override
public void populate(FormDesigner designer) {
this.designer = designer;
this.addAttributeChangeListener(changeListener);
ElementCaseEditor elementCaseEditor = (ElementCaseEditor)xCreator.toData();
this.hComboBox.setSelectedIndex(elementCaseEditor.getHorziontalAttr().getState() - 1);
this.vComboBox.setSelectedIndex(elementCaseEditor.getVerticalAttr().getState() - 1);
this.heightRestrictCheckBox.setSelected(elementCaseEditor.isHeightRestrict());
this.maxHeightLabel.setVisible(elementCaseEditor.isHeightRestrict());
this.maxHeightSpinner.setVisible(elementCaseEditor.isHeightRestrict());
this.maxHeightSpinner.setValue(elementCaseEditor.getHeightPercent());
}
@Override
public void update() {
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); // 触发设计器保存按钮亮起来
String globalName = this.getGlobalName();
switch (globalName) {
case "hComboBox":
((ElementCaseEditor)xCreator.toData()).setHorziontalAttr(MobileFitAttrState.parse(hComboBox.getSelectedIndex() + 1));
break;
case "vComboBox":
((ElementCaseEditor)xCreator.toData()).setVerticalAttr(MobileFitAttrState.parse(vComboBox.getSelectedIndex() + 1));
break;
case "heightRestrictCheckBox":
boolean isHeightRestrict = heightRestrictCheckBox.isSelected();
((ElementCaseEditor)xCreator.toData()).setHeightRestrict(isHeightRestrict);
maxHeightSpinner.setVisible(isHeightRestrict);
maxHeightLabel.setVisible(isHeightRestrict);
}
});
this.maxHeightSpinner.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
break;
case "maxHeightSpinner":
((ElementCaseEditor)xCreator.toData()).setHeightPercent(maxHeightSpinner.getValue());
}
});
break;
}
}
private void setGlobalNames() {
this.hComboBox.setGlobalName("hComboBox");
this.vComboBox.setGlobalName("vComboBox");
this.heightRestrictCheckBox.setGlobalName("heightRestrictCheckBox");
this.maxHeightSpinner.setGlobalName("maxHeightSpinner");
}
}

17
designer_form/src/com/fr/design/widget/ui/designer/mobile/MobileWidgetDefinePane.java

@ -1,13 +1,26 @@
package com.fr.design.widget.ui.designer.mobile;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.design.mainframe.FormDesigner;
/**
* 所有移动端需要拓展的属性面板均继承此类
*
* Created by fanglei on 2017/8/8.
*/
public abstract class MobileWidgetDefinePane extends BasicPane{
public abstract class MobileWidgetDefinePane extends AbstractAttrNoScrollPane{
//初始化panel数据再repaint
public abstract void initPropertyGroups(Object source);
/**
* 从xCreator中提取数据展示在属性面板中
*
* @param designer
*/
public abstract void populate(FormDesigner designer);
/**
* 从属性面板把数据传到后台
*/
public abstract void update();
}

Loading…
Cancel
Save