Fangjie Hu 8 years ago
parent
commit
7ad2fdebb0
  1. 12
      designer/src/com/fr/design/condition/PresentHighlightPane.java
  2. 3
      designer/src/com/fr/design/mainframe/ActiveKeyGenerator.java
  3. 12
      designer_base/src/com/fr/design/utils/DesignUtils.java
  4. 67
      designer_form/src/com/fr/design/designer/beans/adapters/layout/FRParameterLayoutAdapter.java
  5. 9
      designer_form/src/com/fr/design/designer/creator/XWParameterLayout.java

12
designer/src/com/fr/design/condition/PresentHighlightPane.java

@ -97,20 +97,20 @@ public class PresentHighlightPane extends ConditionAttrSingleConditionPane<Highl
}
public void populate(HighlightAction ha) {
int valueIndex = ((PresentHighlightAction)ha).getValueIndex();
Object obj = ((PresentHighlightAction)ha).getValue();
presentComboBox.setSelectedIndex(valueIndex);
present = ((PresentHighlightAction)ha).getPresent();
if(null != obj) {
presentComboBox.setSelectedIndex(0);
this.valueEditor.populate(obj);
} else if(null != present) {
presentComboBox.setSelectedIndex(1);
this.valueEditor.populate(present);
}
}
public HighlightAction update() {
Object value = this.valueEditor.update();
if (presentComboBox.getSelectedIndex() == 1) {
if (value instanceof String) {
present = new NormalPresent(this.valueEditor.update());
}
return new PresentHighlightAction(present);
}
return new PresentHighlightAction(this.valueEditor.update());
}

3
designer/src/com/fr/design/mainframe/ActiveKeyGenerator.java

@ -4,6 +4,7 @@ import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.bbs.BBSConstants;
import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.core.UUID;
@ -194,7 +195,7 @@ public class ActiveKeyGenerator {
//获取char对应的int值
private static int getCharIntValue(char charStr){
if (!BaseUtils.isNum(charStr)) {
if (!StableUtils.isNum(charStr)) {
return 0;
}
return Character.getNumericValue(charStr);

12
designer_base/src/com/fr/design/utils/DesignUtils.java

@ -230,12 +230,15 @@ public class DesignUtils {
private static FRFont getCurrentLocaleFont(){
FRFont guiFRFont;
Locale defaultLocale = Locale.getDefault();
Locale defaultLocale = FRContext.getLocale();
if (isDisplaySimSun(defaultLocale)) {
guiFRFont = getNamedFont("SimSun");
} else if(isDisplayDialog(defaultLocale)) {
guiFRFont = getNamedFont("Dialog");
} else if(isDisplayJapaneseFont(defaultLocale)){
//日文设计器默认用MS Mincho字体渲染
guiFRFont = getNamedFont("MS Mincho");
} else {
guiFRFont = getNamedFont("Tahoma");
}
@ -268,10 +271,13 @@ public class DesignUtils {
return ComparatorUtils.equals(defaultLocale, Locale.SIMPLIFIED_CHINESE);
}
private static boolean isDisplayJapaneseFont(Locale defaultLocale){
return ComparatorUtils.equals(defaultLocale, Locale.JAPANESE)
|| ComparatorUtils.equals(defaultLocale, Locale.JAPAN);
}
private static boolean isDisplayDialog(Locale defaultLocale){
return ComparatorUtils.equals(defaultLocale, Locale.TRADITIONAL_CHINESE)
|| ComparatorUtils.equals(defaultLocale, Locale.JAPANESE)
|| ComparatorUtils.equals(defaultLocale, Locale.JAPAN)
|| ComparatorUtils.equals(defaultLocale, Locale.KOREAN)
|| ComparatorUtils.equals(defaultLocale, Locale.KOREA);
}

67
designer_form/src/com/fr/design/designer/beans/adapters/layout/FRParameterLayoutAdapter.java

@ -1,14 +1,20 @@
package com.fr.design.designer.beans.adapters.layout;
import com.fr.design.beans.GroupModel;
import com.fr.design.designer.beans.ConstraintsGroupModel;
import com.fr.design.designer.beans.HoverPainter;
import com.fr.design.designer.beans.painters.FRParameterLayoutPainter;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.form.parameter.RootDesignGroupModel;
import com.fr.design.utils.ComponentUtils;
import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.ui.container.WParameterLayout;
import java.awt.*;
/**
* 表单参数界面的监听器
*/
@ -40,4 +46,65 @@ public class FRParameterLayoutAdapter extends FRAbsoluteLayoutAdapter {
wabs.refreshTagList();
}
/**
* 是否能在指定位置添加组件
*
* @param creator 组件
* @param x 坐标x
* @param y 坐标y
* @return 能则返回true
*/
@Override
public boolean accept(XCreator creator, int x, int y) {
return x >= 0 && y >= 0 && creator.getHeight() <= container.getHeight()
&& creator.getWidth() <= container.getWidth();
}
@Override
protected void addComp(XCreator creator, int x, int y) {
if (XCreatorUtils.getParentXLayoutContainer(creator) != null) {
Rectangle r = ComponentUtils.getRelativeBounds(container);
Rectangle creatorRectangle = ComponentUtils.getRelativeBounds(creator);
x = creatorRectangle.x - r.x;
y = creatorRectangle.y - r.y;
} else {
int w = creator.getWidth() / 2;
int h = creator.getHeight() / 2;
x = x - w;
y = y - h;
}
fix(creator, x, y);
container.add(creator);
LayoutUtils.layoutRootContainer(container);
}
/**
* 调整组件大小到合适尺寸位置
*
* @param creator 组件
* @param x 坐标x
* @param y 坐标y
*/
@Override
public void fix(XCreator creator, int x, int y) {
if (x < 0) {
x = 0;
} else if (x + creator.getWidth() > container.getWidth()) {
x = container.getWidth() - creator.getWidth();
}
if (y < 0) {
y = 0;
} else if (y + creator.getHeight() > container.getHeight()) {
y = container.getHeight() - creator.getHeight();
}
creator.setLocation(x, y);
}
@Override
public ConstraintsGroupModel getLayoutConstraints(XCreator creator) {
return super.getLayoutConstraints(creator);
}
}

9
designer_form/src/com/fr/design/designer/creator/XWParameterLayout.java

@ -174,4 +174,13 @@ public class XWParameterLayout extends XWAbsoluteLayout {
public XLayoutContainer getTopLayout() {
return this;
}
/**
* 新增删除拉伸后更新每个组件的BoundsWidget
*
* @param xCreator
*/
@Override
public void updateBoundsWidget(XCreator xCreator) {
}
}
Loading…
Cancel
Save