Browse Source

Merge branch 'release' of ssh://www.finedevelop.com:7999/~loy/design_fr into release

master
lonord 8 years ago
parent
commit
7bd8497060
  1. 13
      designer/src/com/fr/design/mainframe/CellElementPropertyPane.java
  2. 6
      designer/src/com/fr/grid/selection/CellSelection.java
  3. 6
      designer/src/com/fr/grid/selection/FloatSelection.java
  4. 2
      designer/src/com/fr/grid/selection/Selection.java
  5. 12
      designer_base/src/com/fr/design/formula/FormulaPane.java
  6. 50
      designer_base/src/com/fr/design/formula/FunctionConstants.java
  7. 4
      designer_base/src/com/fr/design/formula/FunctionGroup.java
  8. 38
      designer_base/src/com/fr/design/fun/impl/AbstractFunctionGroup.java
  9. 20
      designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java
  10. 13
      designer_form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java

13
designer/src/com/fr/design/mainframe/CellElementPropertyPane.java

@ -102,12 +102,23 @@ public class CellElementPropertyPane extends DockingView {
return element; return element;
} }
public void removeAll() {
this.remove(titlePane);
this.remove(cellElementEditPane);
}
public void reInit(ElementCasePane ePane) {
this.add(titlePane, BorderLayout.NORTH);
this.add(cellElementEditPane, BorderLayout.CENTER);
cellElementEditPane.populate(ePane);
}
public void populate(ElementCasePane ePane) { public void populate(ElementCasePane ePane) {
TemplateElementCase elementCase = ePane.getEditingElementCase(); TemplateElementCase elementCase = ePane.getEditingElementCase();
if (elementCase == null) { if (elementCase == null) {
return; return;
} }
cellElementEditPane.populate(ePane); ePane.getSelection().populatePropertyPane(ePane);
} }
@Override @Override

6
designer/src/com/fr/grid/selection/CellSelection.java

@ -18,6 +18,7 @@ import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.imenu.UIMenu; import com.fr.design.gui.imenu.UIMenu;
import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.mainframe.CellElementPropertyPane;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.ElementCasePane.Clear; import com.fr.design.mainframe.ElementCasePane.Clear;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
@ -684,4 +685,9 @@ public class CellSelection extends Selection {
editor.populate(tc); editor.populate(tc);
return editor; return editor;
} }
@Override
public void populatePropertyPane(ElementCasePane ePane) {
CellElementPropertyPane.getInstance().reInit(ePane);
}
} }

6
designer/src/com/fr/grid/selection/FloatSelection.java

@ -20,6 +20,7 @@ import com.fr.design.cell.clipboard.CellElementsClip;
import com.fr.design.cell.clipboard.ElementsTransferable; import com.fr.design.cell.clipboard.ElementsTransferable;
import com.fr.design.cell.clipboard.FloatElementsClip; import com.fr.design.cell.clipboard.FloatElementsClip;
import com.fr.design.designer.TargetComponent; import com.fr.design.designer.TargetComponent;
import com.fr.design.mainframe.CellElementPropertyPane;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
@ -230,4 +231,9 @@ public class FloatSelection extends Selection {
editor.populate(tc); editor.populate(tc);
return editor; return editor;
} }
@Override
public void populatePropertyPane(ElementCasePane ePane) {
CellElementPropertyPane.getInstance().removeAll();
}
} }

2
designer/src/com/fr/grid/selection/Selection.java

@ -88,6 +88,8 @@ public abstract class Selection implements FCloneable, Serializable , Selectable
// //////////////////////////Just4CellSelection/////////////////////////////// // //////////////////////////Just4CellSelection///////////////////////////////
public abstract boolean containsColumnRow(ColumnRow cr); public abstract boolean containsColumnRow(ColumnRow cr);
public abstract void populatePropertyPane(ElementCasePane ePane);
@Override @Override
public Selection clone() throws CloneNotSupportedException { public Selection clone() throws CloneNotSupportedException {

12
designer_base/src/com/fr/design/formula/FormulaPane.java

@ -22,10 +22,8 @@ import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.parser.FRLexer; import com.fr.parser.FRLexer;
import com.fr.parser.FRParser; import com.fr.parser.FRParser;
import com.fr.plugin.ExtraClassManager;
import com.fr.stable.ProductConstants; import com.fr.stable.ProductConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.fun.mark.Mutable;
import com.fr.stable.script.Expression; import com.fr.stable.script.Expression;
import javax.swing.*; import javax.swing.*;
@ -618,13 +616,9 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula{
functionTypeListModel.addElement(FunctionConstants.ALL); functionTypeListModel.addElement(FunctionConstants.ALL);
functionTypeListModel.addElement(FunctionConstants.CUSTOM); functionTypeListModel.addElement(FunctionConstants.CUSTOM);
functionTypeListModel.addElement(FunctionConstants.PLUGIN); functionTypeListModel.addElement(FunctionConstants.PLUGIN);
//hugh:自定义函数分组
Set<Mutable> groups = ExtraClassManager.getInstance().getArray(FunctionGroup.MARK_STRING); //hugh: 从函数分组插件中添加分组
if(!groups.isEmpty()){ FunctionConstants.addFunctionGroupFromPlugins(functionTypeListModel);
for(Mutable group : groups){
functionTypeListModel.addElement(group);
}
}
} }
private void initFunctionNameListCellRenderer(){ private void initFunctionNameListCellRenderer(){

50
designer_base/src/com/fr/design/formula/FunctionConstants.java

@ -11,6 +11,7 @@ import com.fr.stable.EncodeConstants;
import com.fr.stable.OperatingSystem; import com.fr.stable.OperatingSystem;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.fun.FunctionDefContainer;
import com.fr.stable.fun.mark.Mutable; import com.fr.stable.fun.mark.Mutable;
import com.fr.stable.script.Function; import com.fr.stable.script.Function;
import com.fr.stable.script.FunctionDef; import com.fr.stable.script.FunctionDef;
@ -24,8 +25,49 @@ import java.util.*;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipFile; import java.util.zip.ZipFile;
import javax.swing.DefaultListModel;
public abstract class FunctionConstants { public abstract class FunctionConstants {
/**
* 将函数分组插件中的函数添加到对应的列表中
* @param listModel
*/
public static void addFunctionGroupFromPlugins(DefaultListModel listModel){
//hugh:自定义函数分组
Set<Mutable> containers = ExtraClassManager.getInstance().getArray(FunctionDefContainer.MARK_STRING);
if(!containers.isEmpty()){
for(Mutable container : containers){
listModel.addElement(createFunctionGroup((FunctionDefContainer)container));
}
}
}
/**
* 创建一个新的分组
* @param container
* @return
*/
private static FunctionGroup createFunctionGroup(final FunctionDefContainer container){
return new FunctionGroup() {
@Override
public String getGroupName() {
return container.getGroupName();
}
@Override
public NameAndDescription[] getDescriptions() {
FunctionDef[] fs = container.getFunctionDefs();
int count = fs.length;
FunctionDefNAD[] nads = new FunctionDefNAD[count];
for (int i = 0; i < count; i ++) {
nads[i] = new FunctionDefNAD(fs[i]);
}
return nads;
}
};
}
public static FunctionGroup PLUGIN = new FunctionGroup() { public static FunctionGroup PLUGIN = new FunctionGroup() {
@Override @Override
public String getGroupName() { public String getGroupName() {
@ -98,10 +140,10 @@ public abstract class FunctionConstants {
Collections.addAll(all, PLUGIN.getDescriptions()); Collections.addAll(all, PLUGIN.getDescriptions());
Collections.addAll(all, CUSTOM.getDescriptions()); Collections.addAll(all, CUSTOM.getDescriptions());
//hugh:自定义函数分组 //hugh:自定义函数分组
Set<Mutable> groups = ExtraClassManager.getInstance().getArray(FunctionGroup.MARK_STRING); Set<Mutable> containers = ExtraClassManager.getInstance().getArray(FunctionDefContainer.MARK_STRING);
if(!groups.isEmpty()){ if(!containers.isEmpty()){
for(Mutable group : groups){ for(Mutable container : containers){
Collections.addAll(all, ((FunctionGroup)group).getDescriptions()); Collections.addAll(all,createFunctionGroup(((FunctionDefContainer)container)).getDescriptions());
} }
} }
java.util.Collections.sort(all, NameAndDescriptionComparator); java.util.Collections.sort(all, NameAndDescriptionComparator);

4
designer_base/src/com/fr/design/formula/FunctionGroup.java

@ -2,10 +2,6 @@ package com.fr.design.formula;
public interface FunctionGroup { public interface FunctionGroup {
int CURRENT_LEVEL = 1;
String MARK_STRING = "FunctionGroup";
String getGroupName(); String getGroupName();
NameAndDescription[] getDescriptions(); NameAndDescription[] getDescriptions();
} }

38
designer_base/src/com/fr/design/fun/impl/AbstractFunctionGroup.java

@ -1,38 +0,0 @@
package com.fr.design.fun.impl;
import com.fr.design.formula.FunctionDefNAD;
import com.fr.design.formula.FunctionGroup;
import com.fr.design.formula.NameAndDescription;
import com.fr.stable.fun.mark.API;
import com.fr.stable.fun.mark.Mutable;
import com.fr.stable.script.FunctionDef;
@API(level = FunctionGroup.CURRENT_LEVEL)
public abstract class AbstractFunctionGroup implements Mutable, FunctionGroup {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public String mark4Provider() {
return getClass().getName();
}
@Override
public NameAndDescription[] getDescriptions() {
FunctionDef[] funcs = getFunctionDefs();
int count = funcs.length;
FunctionDefNAD[] nads = new FunctionDefNAD[count];
for (int i = 0; i < count; i ++) {
nads[i] = new FunctionDefNAD(funcs[i]);
}
return nads;
}
public FunctionDef[] getFunctionDefs(){
return new FunctionDef[0];
}
}

20
designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java

@ -47,6 +47,7 @@ public class XCardSwitchButton extends XButton {
//设置的图片类型 //设置的图片类型
private static final String COLORBACKGROUNDTYPE = "ColorBackground"; private static final String COLORBACKGROUNDTYPE = "ColorBackground";
private static final String DEFAULTTYPE = "default"; private static final String DEFAULTTYPE = "default";
private static final String DEFAULT_FONT_NAME = "SimSun";
//默认颜色 //默认颜色
public static final Color NORMAL_GRAL = new Color(236,236,236); public static final Color NORMAL_GRAL = new Color(236,236,236);
@ -65,6 +66,7 @@ public class XCardSwitchButton extends XButton {
private static final int FONT_SIZE_ADJUST = 2; private static final int FONT_SIZE_ADJUST = 2;
private static final int SIDE_OFFSET = 57; private static final int SIDE_OFFSET = 57;
private static final int FONT_SIZE = 9;
private XWCardLayout cardLayout; private XWCardLayout cardLayout;
private XWCardTagLayout tagLayout; private XWCardTagLayout tagLayout;
@ -252,6 +254,8 @@ public class XCardSwitchButton extends XButton {
int width = button.getWidth(); int width = button.getWidth();
int height = button.getHeight(); int height = button.getHeight();
ey = ey % DEFAULT_BUTTON_HEIGHT;
// 鼠标进入按钮右侧删除图标区域 // 鼠标进入按钮右侧删除图标区域
double recX = position.getX() + (width - RIGHT_OFFSET); double recX = position.getX() + (width - RIGHT_OFFSET);
double recY = position.getY() + (height - TOP_OFFSET); double recY = position.getY() + (height - TOP_OFFSET);
@ -318,6 +322,9 @@ public class XCardSwitchButton extends XButton {
// 标题部分 // 标题部分
WidgetTitle title = style.getTitle(); WidgetTitle title = style.getTitle();
FRFont font = button.getFont(); FRFont font = button.getFont();
if (font == null) {
font = FRFont.getInstance(DEFAULT_FONT_NAME, 0, FONT_SIZE);
}
FRFont newFont = FRFont.getInstance(font.getName(),font.getStyle(),font.getSize() + FONT_SIZE_ADJUST); FRFont newFont = FRFont.getInstance(font.getName(),font.getStyle(),font.getSize() + FONT_SIZE_ADJUST);
UILabel label = this.getContentLabel(); UILabel label = this.getContentLabel();
label.setFont(newFont); label.setFont(newFont);
@ -337,6 +344,12 @@ public class XCardSwitchButton extends XButton {
//删除tab布局 //删除tab布局
private void deleteTabLayout(SelectionModel selectionModel,FormDesigner designer){ private void deleteTabLayout(SelectionModel selectionModel,FormDesigner designer){
String titleName = this.getContentLabel().getText();
int value = JOptionPane.showConfirmDialog(null, Inter.getLocText("FR-Designer_ConfirmDialog_Content") + "“" + titleName + "”",
Inter.getLocText("FR-Designer_ConfirmDialog_Title"),JOptionPane.YES_NO_OPTION);
if (value != JOptionPane.OK_OPTION) {
return;
}
XLayoutContainer mainLayout = this.cardLayout.getBackupParent(); XLayoutContainer mainLayout = this.cardLayout.getBackupParent();
if(mainLayout != null){ if(mainLayout != null){
selectionModel.setSelectedCreator(mainLayout); selectionModel.setSelectedCreator(mainLayout);
@ -363,7 +376,7 @@ public class XCardSwitchButton extends XButton {
XCardSwitchButton temp = (XCardSwitchButton) this.tagLayout.getComponent(i); XCardSwitchButton temp = (XCardSwitchButton) this.tagLayout.getComponent(i);
CardSwitchButton tempCard = (CardSwitchButton) temp.toData(); CardSwitchButton tempCard = (CardSwitchButton) temp.toData();
String tempText = tempCard.getText(); String tempText = tempCard.getText();
Font f = ((CardSwitchButton)this.toData()).getFont(); Font f = tempCard.getFont();
FontMetrics fm = GraphHelper.getFontMetrics(f); FontMetrics fm = GraphHelper.getFontMetrics(f);
cardWidth.put(i,fm.stringWidth(tempText)); cardWidth.put(i,fm.stringWidth(tempText));
cardHeight.put(i,fm.getHeight()); cardHeight.put(i,fm.getHeight());
@ -387,9 +400,12 @@ public class XCardSwitchButton extends XButton {
this.tagLayout.getComponent(i).setBounds(rectangle); this.tagLayout.getComponent(i).setBounds(rectangle);
Dimension dimension = new Dimension(); Dimension dimension = new Dimension();
dimension.setSize(cardWidth, cardHeight); dimension.setSize(cardWidth, cardHeight);
XCardSwitchButton temp = (XCardSwitchButton) this.tagLayout.getComponent(i);
CardSwitchButton cardSwitchButton = (CardSwitchButton) temp.toData(); CardSwitchButton cardSwitchButton = (CardSwitchButton) temp.toData();
FRFont frFont = cardSwitchButton.getFont(); FRFont frFont = cardSwitchButton.getFont();
XCardSwitchButton temp = (XCardSwitchButton) this.tagLayout.getComponent(i); if (frFont == null) {
frFont = FRFont.getInstance(DEFAULT_FONT_NAME, 0, FONT_SIZE);
}
UILabel label = temp.getContentLabel(); UILabel label = temp.getContentLabel();
label.setSize(dimension); label.setSize(dimension);
label.setFont(frFont.applyResolutionNP(ScreenResolution.getScreenResolution())); label.setFont(frFont.applyResolutionNP(ScreenResolution.getScreenResolution()));

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

@ -45,6 +45,9 @@ public class XWTabFitLayout extends XWFitLayout {
// tab布局在拖拽导致的缩放里(含间隔时),如果拖拽宽高大于组件宽高,会导致调整的时候找不到原来的组件 // tab布局在拖拽导致的缩放里(含间隔时),如果拖拽宽高大于组件宽高,会导致调整的时候找不到原来的组件
// 这里先将拖拽之前的宽高先做备份 // 这里先将拖拽之前的宽高先做备份
private static final Color NORMAL_GRAL = new Color(236,236,236); private static final Color NORMAL_GRAL = new Color(236,236,236);
private static final String DEFAULT_FONT_NAME = "SimSun";
public final static Font DEFAULTFT = new Font("Song_TypeFace",0,12);
public final static FRFont DEFAULT_FRFT = FRFont.getInstance(DEFAULT_FONT_NAME, 0, 9);
private Dimension referDim; private Dimension referDim;
private Background initialBackground; private Background initialBackground;
private Background overBackground; private Background overBackground;
@ -229,16 +232,24 @@ public class XWTabFitLayout extends XWFitLayout {
boolean isStyle = ((WTabFitLayout) data).isCustomStyle(); boolean isStyle = ((WTabFitLayout) data).isCustomStyle();
Background bg; Background bg;
bg = ColorBackground.getInstance(NORMAL_GRAL); bg = ColorBackground.getInstance(NORMAL_GRAL);
CardSwitchButton cardSwitchButton = (CardSwitchButton) this.xCardSwitchButton.toData();
if (!isStyle) { if (!isStyle) {
this.xCardSwitchButton.setCustomStyle(false); this.xCardSwitchButton.setCustomStyle(false);
this.xCardSwitchButton.setSelectBackground(bg); this.xCardSwitchButton.setSelectBackground(bg);
this.xCardSwitchButton.getLabel().setFont(DEFAULTFT);
cardSwitchButton.setInitialBackground(null);
cardSwitchButton.setClickBackground(null);
cardSwitchButton.setOverBackground(null);
cardSwitchButton.setFont(DEFAULT_FRFT);
} else { } else {
CardSwitchButton cardSwitchButton = (CardSwitchButton) this.xCardSwitchButton.toData();
Background initialBackground = cardSwitchButton.getInitialBackground(); Background initialBackground = cardSwitchButton.getInitialBackground();
bg = initialBackground == null ? bg : initialBackground; bg = initialBackground == null ? bg : initialBackground;
this.xCardSwitchButton.setSelectBackground(bg); this.xCardSwitchButton.setSelectBackground(bg);
this.xCardSwitchButton.setCustomStyle(true); this.xCardSwitchButton.setCustomStyle(true);
cardSwitchButton.setCustomStyle(true); cardSwitchButton.setCustomStyle(true);
if (font != null) {
cardSwitchButton.setFont(font);
}
} }
} }

Loading…
Cancel
Save