Browse Source

Merge pull request #6204 in DESIGN/design from release/11.0 to feature/x

* commit 'e74e62310a55f6b145df68803a5460d4d3de299e':
  REPORT-60717 【主题切换】设置组件内边距后边框线显示有问题
  REPORT-60812 【主题切换】主题面板的框框显示有点出入
  REPORT-59089 【主题切换】主题比较多有滚动条,右侧主题的勾选图标有点显示不全
  无jira任务, feature/x 合 release/11.0 解决冲突
  REPORT-58012
  REPORT-60561 全局自适应-样式细节优化
  REPORT-60561 全局自适应-样式细节优化
research/11.0
superman 3 years ago
parent
commit
52262f0c7d
  1. 38
      designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java
  2. 27
      designer-base/src/main/java/com/fr/design/data/NameChangeBean.java
  3. 12
      designer-base/src/main/java/com/fr/design/gui/frpane/UITabbedPane.java
  4. 21
      designer-base/src/main/java/com/fr/design/gui/frpane/UITabbedPaneUI.java
  5. 1
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPagesPane.java
  6. 57
      designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ComponentPreviewPane.java
  7. 38
      designer-base/src/main/java/com/fr/design/report/fit/BaseFitAttrPane.java
  8. 77
      designer-form/src/main/java/com/fr/design/actions/FormFitAttrAction.java
  9. 33
      designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java
  10. 33
      designer-form/src/main/java/com/fr/design/designer/creator/XWTitleLayout.java
  11. 11
      designer-form/src/main/java/com/fr/design/fit/NewJForm.java
  12. 6
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  13. 10
      designer-realize/src/main/java/com/fr/design/webattr/ServerFitAttrPane.java

38
designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java

@ -47,9 +47,11 @@ import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -71,8 +73,8 @@ public abstract class DesignTableDataManager {
* 其实globalDsCache没有绝对的必要只是为了操作方便如果没有它那么每次清空服务器数据集或者存储过程的时候还要去遍历找一下 * 其实globalDsCache没有绝对的必要只是为了操作方便如果没有它那么每次清空服务器数据集或者存储过程的时候还要去遍历找一下
* 这个操作可能比较复杂 从减少代码复杂度的角度看还是很有必要的 * 这个操作可能比较复杂 从减少代码复杂度的角度看还是很有必要的
*/ */
private static java.util.Map<String, TableDataWrapper> globalDsCache = new java.util.HashMap<String, TableDataWrapper>(); private static Map<String, TableDataWrapper> globalDsCache = new java.util.HashMap<String, TableDataWrapper>();
private static java.util.Map<String, String> dsNameChangedMap = new HashMap<String, String>(); private static Set<NameChangeBean> dsNameChangedSet = new LinkedHashSet<>();
private static List<ChangeListener> globalDsListeners = new ArrayList<>(); private static List<ChangeListener> globalDsListeners = new ArrayList<>();
private static Map<String, List<ChangeListener>> dsListenersMap = new ConcurrentHashMap<>(); private static Map<String, List<ChangeListener>> dsListenersMap = new ConcurrentHashMap<>();
@ -123,7 +125,7 @@ public abstract class DesignTableDataManager {
public static void envChange() { public static void envChange() {
columnCache.clear(); columnCache.clear();
dsListenersMap.clear(); dsListenersMap.clear();
dsNameChangedMap.clear(); dsNameChangedSet.clear();
clearGlobalDs(); clearGlobalDs();
} }
@ -136,17 +138,17 @@ public abstract class DesignTableDataManager {
public static void fireDSChanged(Map<String, String> dsNameChangedMap) { public static void fireDSChanged(Map<String, String> dsNameChangedMap) {
clearGlobalDs(); clearGlobalDs();
if (!dsNameChangedMap.isEmpty()) { if (!dsNameChangedMap.isEmpty()) {
setDsNameChangedMap(dsNameChangedMap); setDsNameChangedSet(dsNameChangedMap);
} }
fireDsChanged(); fireDsChanged();
dsNameChangedMap.clear(); dsNameChangedMap.clear();
} }
private static void setDsNameChangedMap(Map<String, String> map) { private static void setDsNameChangedSet(Map<String, String> map) {
Iterator iterator = map.keySet().iterator(); Iterator iterator = map.keySet().iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
String key = (String) iterator.next(); String key = (String) iterator.next();
dsNameChangedMap.put(key, map.get(key)); dsNameChangedSet.add(new NameChangeBean(key, map.get(key)));
} }
} }
@ -157,23 +159,21 @@ public abstract class DesignTableDataManager {
* @return 是则返回true * @return 是则返回true
*/ */
public static boolean isDsNameChanged(String oldDsName) { public static boolean isDsNameChanged(String oldDsName) {
return dsNameChangedMap.containsKey(oldDsName); for (NameChangeBean bean : dsNameChangedSet) {
if (ComparatorUtils.equals(oldDsName, bean.getOldName())) {
return true;
} }
}
public static String getChangedDsNameByOldDsName(String oldDsName) { return false;
String changeName;
if (isDsNameChanged(oldDsName)) {
changeName = dsNameChangedMap.get(oldDsName);
} else {
changeName = StringUtils.EMPTY;
} }
if (StringUtils.isNotEmpty(changeName)) { public static String getChangedDsNameByOldDsName(String dsName) {
return getChangedDsNameByOldDsName(changeName); for (NameChangeBean bean : dsNameChangedSet) {
} else { if (ComparatorUtils.equals(dsName, bean.getOldName())) {
return oldDsName; dsName = bean.getChangedName();
}
} }
return dsName;
} }
public static void addGlobalDsChangeListener(ChangeListener l) { public static void addGlobalDsChangeListener(ChangeListener l) {

27
designer-base/src/main/java/com/fr/design/data/NameChangeBean.java

@ -0,0 +1,27 @@
package com.fr.design.data;
public class NameChangeBean {
private String oldName;
private String changedName;
public NameChangeBean(String oldName, String changedName) {
this.oldName = oldName;
this.changedName = changedName;
}
public String getOldName() {
return oldName;
}
public void setOldName(String oldName) {
this.oldName = oldName;
}
public String getChangedName() {
return changedName;
}
public void setChangedName(String changedName) {
this.changedName = changedName;
}
}

12
designer-base/src/main/java/com/fr/design/gui/frpane/UITabbedPane.java

@ -21,6 +21,8 @@ public class UITabbedPane extends JTabbedPane{
private String classPath; //panel对象的类名 private String classPath; //panel对象的类名
private String tabName; //Tab名称 private String tabName; //Tab名称
private int tabSize = 0; private int tabSize = 0;
private Color tabBorderColor;
public UITabbedPane() { public UITabbedPane() {
super(); super();
} }
@ -93,6 +95,16 @@ public class UITabbedPane extends JTabbedPane{
public int getTabSize(){ public int getTabSize(){
return tabSize; return tabSize;
} }
public Color getTabBorderColor() {
return tabBorderColor;
}
public void setTabBorderColor(Color tabBorderColor) {
this.tabBorderColor = tabBorderColor;
repaint();
}
@Override @Override
/** /**
* 获取UI对象 * 获取UI对象

21
designer-base/src/main/java/com/fr/design/gui/frpane/UITabbedPaneUI.java

@ -31,9 +31,20 @@ public class UITabbedPaneUI extends BasicTabbedPaneUI {
private int addX = -1; private int addX = -1;
private int addY = -1; private int addY = -1;
private int rollover = -1; private int rollover = -1;
private Color tabBorderColor = new Color(143, 160, 183); private final Color DEFAULT_TAB_BORDER_COLOR = new Color(143, 160, 183);
private Color[] tabSelectedColor = {UIConstants.NORMAL_BLUE, UIConstants.NORMAL_BLUE, UIConstants.NORMAL_BLUE}; private Color[] tabSelectedColor = {UIConstants.NORMAL_BLUE, UIConstants.NORMAL_BLUE, UIConstants.NORMAL_BLUE};
public Color getTabBorderColor() {
Color color = null;
if (tabPane instanceof UITabbedPane) {
color = ((UITabbedPane) tabPane).getTabBorderColor();
}
if (color == null) {
color = DEFAULT_TAB_BORDER_COLOR;
}
return color;
}
/** /**
* 创建UI对象 * 创建UI对象
* *
@ -252,9 +263,9 @@ public class UITabbedPaneUI extends BasicTabbedPaneUI {
private void drawUITabBorder(Graphics g, int tabPlacement, int x, int y, int w, int h, private void drawUITabBorder(Graphics g, int tabPlacement, int x, int y, int w, int h,
boolean isSelected, boolean isEnabled, boolean isRollover) { boolean isSelected, boolean isEnabled, boolean isRollover) {
if (!isEnabled) { if (!isEnabled) {
drawUITabBorder(g, tabBorderColor, x, y, w, h, tabPlacement); drawUITabBorder(g, getTabBorderColor(), x, y, w, h, tabPlacement);
} else if (isSelected || isRollover) { } else if (isSelected || isRollover) {
drawSelectedUITabBorder(g, tabBorderColor, x, y, w, h, tabPlacement); drawSelectedUITabBorder(g, getTabBorderColor(), x, y, w, h, tabPlacement);
if (isRollover && canClose()) { if (isRollover && canClose()) {
closeX = x + w - closeIcon.getIconWidth() - 3; closeX = x + w - closeIcon.getIconWidth() - 3;
closeY = 0; closeY = 0;
@ -269,7 +280,7 @@ public class UITabbedPaneUI extends BasicTabbedPaneUI {
closeIcon.paintIcon(tabPane, g, closeX, closeY); closeIcon.paintIcon(tabPane, g, closeX, closeY);
} }
} else { } else {
drawUITabBorder(g, tabBorderColor, x, y, w, h, tabPlacement); drawUITabBorder(g, getTabBorderColor(), x, y, w, h, tabPlacement);
} }
} }
@ -322,7 +333,7 @@ public class UITabbedPaneUI extends BasicTabbedPaneUI {
} }
private void drawUIContentBorder(Graphics g, int x, int y, int w, int h) { private void drawUIContentBorder(Graphics g, int x, int y, int w, int h) {
g.setColor(tabBorderColor); g.setColor(getTabBorderColor());
g.drawRect(x, y, w - 3, h - 3); g.drawRect(x, y, w - 3, h - 3);
// Shadow // Shadow
g.setColor(new Color(204, 204, 204)); g.setColor(new Color(204, 204, 204));

1
designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPagesPane.java

@ -293,6 +293,7 @@ public class TemplateThemeGridPagesPane extends JPanel {
setLayout(FRGUIPaneFactory.createBorderLayout()); setLayout(FRGUIPaneFactory.createBorderLayout());
tabbedPane = new UITabbedPane(); tabbedPane = new UITabbedPane();
tabbedPane.setTabBorderColor(new Color(0xE0E0E1));
add(tabbedPane, BorderLayout.CENTER); add(tabbedPane, BorderLayout.CENTER);
formThemesManagerPane = TemplateThemeGridControlPane.createFormThemesManagerPane(); formThemesManagerPane = TemplateThemeGridControlPane.createFormThemesManagerPane();

57
designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ComponentPreviewPane.java

@ -90,6 +90,37 @@ public abstract class ComponentPreviewPane extends UINoOpaquePanel implements Th
} }
@Override
protected void paintBorder(Graphics g) {
super.paintBorder(g);
paintSeparator((Graphics2D) g);
}
private void paintSeparator(Graphics2D g2d) {
Border border = getBorder();
if (border instanceof LineBorder && titlePane != null) {
Border containerBorder = container.getBorder();
Insets insets = containerBorder.getBorderInsets(container);
int y = titlePane.getHeight() + insets.top;
Color oldColor = g2d.getColor();
Stroke oldStroke = g2d.getStroke();
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
Color lineColor = ((LineBorder) border).getLineColor();
int thickness = ((LineBorder) border).getThickness();
g2d.setColor(lineColor);
g2d.setStroke(new BasicStroke(thickness * 2));
g2d.drawLine(0, y, getWidth(), y);
g2d.setStroke(oldStroke);
g2d.setColor(oldColor);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
}
}
@Override @Override
public void paint(Graphics g) { public void paint(Graphics g) {
Graphics2D g2d = (Graphics2D) g; Graphics2D g2d = (Graphics2D) g;
@ -144,7 +175,6 @@ public abstract class ComponentPreviewPane extends UINoOpaquePanel implements Th
data.setInsetImagePadding(titlePacker.getInsetImagePadding()); data.setInsetImagePadding(titlePacker.getInsetImagePadding());
data.setInsetRelativeTextLeft(titlePacker.isInsetRelativeTextLeft()); data.setInsetRelativeTextLeft(titlePacker.isInsetRelativeTextLeft());
data.setInsetRelativeTextRight(titlePacker.isInsetRelativeTextRight()); data.setInsetRelativeTextRight(titlePacker.isInsetRelativeTextRight());
this.setBorder(new BottomLineBorder(componentStyle.getStyle().getColor(), componentStyle.getStyle().getBorder()));
} }
public Label getData(){ public Label getData(){
@ -172,31 +202,6 @@ public abstract class ComponentPreviewPane extends UINoOpaquePanel implements Th
} }
public static class BottomLineBorder extends LineBorder {
private BottomLineBorder(Color color, int thickness) {
super(color, thickness);
}
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
Graphics2D g2d = (Graphics2D) g;
Color oldColor = g2d.getColor();
Stroke oldStroke = g2d.getStroke();
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setColor(getLineColor());
g2d.setStroke(new BasicStroke(getThickness() * 2));
g2d.drawLine(0, height, width, height);
g2d.setStroke(oldStroke);
g2d.setColor(oldColor);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
}
}
private static class Utils { private static class Utils {
private static void paintBackground(Graphics2D g2d, Background background, Shape shape, float opacity) { private static void paintBackground(Graphics2D g2d, Background background, Shape shape, float opacity) {

38
designer-base/src/main/java/com/fr/design/report/fit/BaseFitAttrPane.java

@ -15,9 +15,7 @@ import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.report.fit.ReportFitAttr; import com.fr.report.fit.ReportFitAttr;
import javax.swing.*; import javax.swing.*;
import javax.swing.border.EmptyBorder;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -33,6 +31,7 @@ import static com.fr.design.i18n.Toolkit.i18nText;
public abstract class BaseFitAttrPane extends BasicBeanPane<ReportFitAttr> { public abstract class BaseFitAttrPane extends BasicBeanPane<ReportFitAttr> {
protected JPanel contentJPanel; protected JPanel contentJPanel;
protected UILabel belowSetLabel;
protected UIComboBox itemChoose; protected UIComboBox itemChoose;
protected java.util.List<FitAttrModel> fitAttrModelList = new ArrayList<>(); protected java.util.List<FitAttrModel> fitAttrModelList = new ArrayList<>();
@ -98,7 +97,7 @@ public abstract class BaseFitAttrPane extends BasicBeanPane<ReportFitAttr> {
} }
attrJPanel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); attrJPanel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
attrJPanel.setBorder(new EmptyBorder(0, 100, 10, 100)); attrJPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 10, 0));
contentJPanel.add(attrJPanel); contentJPanel.add(attrJPanel);
} }
@ -137,9 +136,18 @@ public abstract class BaseFitAttrPane extends BasicBeanPane<ReportFitAttr> {
protected void initPreviewJPanel() { protected void initPreviewJPanel() {
previewJPanel = new FitPreviewPane(); previewJPanel = new FitPreviewPane();
previewJPanel.setBorder(BorderFactory.createEmptyBorder(0, getPreviewJPanelLeft(), 0, 0));
contentJPanel.add(previewJPanel); contentJPanel.add(previewJPanel);
} }
private int getPreviewJPanelLeft() {
int left = 0;
if (belowSetLabel.getPreferredSize() != null) {
left = belowSetLabel.getPreferredSize().width + BELOW_SET_COMPONENT_HSPACE;
}
return left;
}
protected int getStateInPC(int index) { protected int getStateInPC(int index) {
FitType[] fitTypes = fitAttrModel.getFitTypes(); FitType[] fitTypes = fitAttrModel.getFitTypes();
return fitTypes[index].getState(); return fitTypes[index].getState();
@ -189,29 +197,26 @@ public abstract class BaseFitAttrPane extends BasicBeanPane<ReportFitAttr> {
protected void initComponents() { protected void initComponents() {
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
contentJPanel = new JPanel(); contentJPanel = FRGUIPaneFactory.createVerticalFlowLayout_Pane(false, FlowLayout.LEFT, 0, 0);
contentJPanel.setLayout(FRGUIPaneFactory.createCenterFlowLayout());
this.add(contentJPanel); this.add(contentJPanel);
initItemChoose(); initItemChoose();
initPrompt();
} }
private void initItemChoose() { private void initItemChoose() {
JPanel chooseJPanel = new JPanel(); JPanel chooseJPanel = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane();
chooseJPanel.setLayout(FRGUIPaneFactory.createLabelFlowLayout());
ItemListener itemListener = getItemListener(); ItemListener itemListener = getItemListener();
itemChoose = new UIComboBox(getItemNames()); itemChoose = new UIComboBox(getItemNames());
itemChoose.addItemListener(itemListener); itemChoose.addItemListener(itemListener);
UILabel belowSetLabel = new UILabel(i18nText("Fine-Design_Report_Blow_Set")); belowSetLabel = new UILabel(i18nText("Fine-Design_Report_Blow_Set"));
JPanel hSpaceLabel = new JPanel();
hSpaceLabel.setSize(BELOW_SET_COMPONENT_HSPACE, 0);
JPanel buttonPane = GUICoreUtils.createFlowPane(new Component[]{ JPanel buttonPane = GUICoreUtils.createFlowPane(new Component[]{
belowSetLabel, itemChoose}, FlowLayout.LEFT, BELOW_SET_COMPONENT_HSPACE); belowSetLabel, hSpaceLabel, itemChoose}, FlowLayout.LEFT);
chooseJPanel.add(buttonPane); chooseJPanel.add(buttonPane);
chooseJPanel.setPreferredSize(new Dimension(500, 50)); chooseJPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
JPanel jPanel = new JPanel(); contentJPanel.add(chooseJPanel);
jPanel.setLayout(FRGUIPaneFactory.createBorderLayout());
jPanel.add(chooseJPanel, BorderLayout.WEST);
contentJPanel.add(jPanel);
} }
@ -222,6 +227,9 @@ public abstract class BaseFitAttrPane extends BasicBeanPane<ReportFitAttr> {
} }
protected void initPrompt() {
}
protected void refresh() { protected void refresh() {
validate(); validate();
repaint(); repaint();

77
designer-form/src/main/java/com/fr/design/actions/FormFitAttrAction.java

@ -1,77 +0,0 @@
package com.fr.design.actions;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.UIDialog;
import com.fr.design.fit.DesignerUIModeConfig;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.report.fit.menupane.TemplateFitAttrPane;
import com.fr.report.fit.FitProvider;
import com.fr.report.fit.ReportFitAttr;
import javax.swing.KeyStroke;
import java.awt.event.ActionEvent;
/**
* Created by Administrator on 2015/7/6 0006.
*/
public class FormFitAttrAction extends JTemplateAction {
private static final MenuKeySet REPORT_FIT_ATTR_ELEMENTCASE = new MenuKeySet() {
@Override
public char getMnemonic() {
return 'T';
}
@Override
public String getMenuName() {
return DesignerUIModeConfig.getInstance().newUIMode() ?
com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit_PC_Adaptive_Attr") :
com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_PC_Element_Case_Fit_Attr");
}
@Override
public KeyStroke getKeyStroke() {
return null;
}
};
public FormFitAttrAction(JTemplate jTemplate) {
super(jTemplate);
initMenuStyle();
}
private void initMenuStyle() {
this.setMenuKeySet(REPORT_FIT_ATTR_ELEMENTCASE);
this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(DesignerUIModeConfig.getInstance().newUIMode() ?
"/com/fr/design/images/reportfit/fit.png" :
"/com/fr/design/images/reportfit/fit");
}
@Override
public void actionPerformed(ActionEvent e) {
final JTemplate jwb = getEditingComponent();
if (jwb == null) {
return;
}
final FitProvider wbTpl = (FitProvider) jwb.getTarget();
ReportFitAttr fitAttr = wbTpl.getReportFitAttr();
TemplateFitAttrPane templateFitAttrPane = new TemplateFitAttrPane(jwb);
showFitDialog(fitAttr, jwb, wbTpl, templateFitAttrPane);
}
private void showFitDialog(ReportFitAttr fitAttr, final JTemplate jwb, final FitProvider wbTpl, final BasicBeanPane<ReportFitAttr> attrPane) {
attrPane.populateBean(fitAttr);
UIDialog dialog = attrPane.showMediumWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override
public void doOk() {
wbTpl.setReportFitAttr(attrPane.updateBean());
jwb.fireTargetModified();
}
});
dialog.setVisible(true);
}
}

33
designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java

@ -273,12 +273,7 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
parentCreator.setBorder(border); // 容器绘制完整边框 parentCreator.setBorder(border); // 容器绘制完整边框
bodyCreator.setBorder(BorderFactory.createEmptyBorder()); // body不绘制边框 bodyCreator.setBorder(BorderFactory.createEmptyBorder()); // body不绘制边框
titleCreator.setBorder(BorderFactory.createEmptyBorder()); // title绘制底部边框 titleCreator.setBorder(BorderFactory.createEmptyBorder()); // title不绘制边框
if (border instanceof LineBorder) {
Color color = ((LineBorder) border).getLineColor();
int thickness = ((LineBorder) border).getThickness();
titleCreator.setBorder(new BottomLineBorder(color, thickness));
}
if (bodyCreator instanceof XBorderStyleWidgetCreator) { if (bodyCreator instanceof XBorderStyleWidgetCreator) {
XBorderStyleWidgetCreator styledBodyXCreator = (XBorderStyleWidgetCreator) bodyCreator; XBorderStyleWidgetCreator styledBodyXCreator = (XBorderStyleWidgetCreator) bodyCreator;
@ -407,32 +402,6 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
} }
// 适用于标题栏的底部边框
public static class BottomLineBorder extends LineBorder {
private BottomLineBorder(Color color, int thickness) {
super(color, thickness);
}
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
Graphics2D g2d = (Graphics2D)g;
Color oldColor = g2d.getColor();
Stroke oldStroke = g2d.getStroke();
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setColor(getLineColor());
g2d.setStroke(new BasicStroke(getThickness() * 2));
g2d.drawLine(0, height, width, height);
g2d.setStroke(oldStroke);
g2d.setColor(oldColor);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
}
}
public static class NoBackgroundPaneUI extends BasicPanelUI { public static class NoBackgroundPaneUI extends BasicPanelUI {
@Override @Override
public void update(Graphics g, JComponent c) { public void update(Graphics g, JComponent c) {

33
designer-form/src/main/java/com/fr/design/designer/creator/XWTitleLayout.java

@ -15,6 +15,8 @@ import com.fr.form.ui.container.WTitleLayout;
import com.fr.general.Background; import com.fr.general.Background;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import javax.swing.border.Border;
import javax.swing.border.LineBorder;
import java.awt.*; import java.awt.*;
import java.awt.event.ContainerEvent; import java.awt.event.ContainerEvent;
import java.awt.geom.Rectangle2D; import java.awt.geom.Rectangle2D;
@ -187,6 +189,37 @@ public class XWTitleLayout extends DedicateLayoutContainer {
} }
@Override
protected void paintBorder(Graphics g) {
super.paintBorder(g);
paintSeparator((Graphics2D) g);
}
private void paintSeparator(Graphics2D g2d) {
Border border = getBorder();
XCreator titleCreator = getTitleCreator();
if (border instanceof LineBorder && titleCreator != null) {
int height = titleCreator.getHeight();
Insets paddingInsets = getInsets();
int y = height + paddingInsets.top;
Color oldColor = g2d.getColor();
Stroke oldStroke = g2d.getStroke();
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
Color lineColor = ((LineBorder) border).getLineColor();
int thickness = ((LineBorder) border).getThickness();
g2d.setColor(lineColor);
g2d.setStroke(new BasicStroke(thickness * 2));
g2d.drawLine(0, y, getWidth(), y);
g2d.setStroke(oldStroke);
g2d.setColor(oldColor);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
}
}
@Override @Override
public void paintBackground(Graphics2D g2d) { public void paintBackground(Graphics2D g2d) {
if (getComponentCount() > 1) { if (getComponentCount() > 1) {

11
designer-form/src/main/java/com/fr/design/fit/NewJForm.java

@ -13,7 +13,6 @@ import com.fr.design.fit.common.AdaptiveSwitchUtil;
import com.fr.design.fit.common.LayoutTool; import com.fr.design.fit.common.LayoutTool;
import com.fr.form.fit.NewFormMarkAttr; import com.fr.form.fit.NewFormMarkAttr;
import com.fr.design.fit.common.TemplateTool; import com.fr.design.fit.common.TemplateTool;
import com.fr.design.actions.FormFitAttrAction;
import com.fr.design.actions.NewFormMobileAttrAction; import com.fr.design.actions.NewFormMobileAttrAction;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.preview.DeveloperPreview; import com.fr.design.preview.DeveloperPreview;
@ -92,7 +91,7 @@ public class NewJForm extends JForm {
Rectangle rectangle = LayoutTool.getAbsoluteBodySize(this); Rectangle rectangle = LayoutTool.getAbsoluteBodySize(this);
if (!isNewJFrom() && (rectangle.width != bodyWidth || rectangle.height != bodyHeight)) { if (!isNewJFrom() && (rectangle.width != bodyWidth || rectangle.height != bodyHeight)) {
TemplateTool.onlyChangeAbsoluteBodySize(bodyHeight, bodyWidth, this); TemplateTool.onlyChangeAbsoluteBodySize(bodyHeight, bodyWidth, this);
} else if(isNewJFrom()){ } else if (isNewJFrom()) {
if (rectangle.width > bodyWidth && rectangle.height > bodyHeight) { if (rectangle.width > bodyWidth && rectangle.height > bodyHeight) {
TemplateTool.onlyChangeAbsoluteBodySize(rectangle.height, rectangle.width, this); TemplateTool.onlyChangeAbsoluteBodySize(rectangle.height, rectangle.width, this);
} else if (rectangle.width > bodyWidth) { } else if (rectangle.width > bodyWidth) {
@ -129,9 +128,9 @@ public class NewJForm extends JForm {
@Override @Override
public ShortCut[] shortcut4TemplateMenu() { public ShortCut[] shortcut4TemplateMenu() {
if (this.index == FORM_TAB) { if (this.index == FORM_TAB) {
return ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new NewFormMobileAttrAction(this), new FormFitAttrAction(this)}, new ShortCut[0]); return ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new NewFormMobileAttrAction(this), getReportFitAttrAction()}, new ShortCut[0]);
} else { } else {
return ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new NewFormMobileAttrAction(this), new FormFitAttrAction(this)}, this.getElementCaseDesign().shortcut4TemplateMenu()); return ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new NewFormMobileAttrAction(this), getReportFitAttrAction()}, this.getElementCaseDesign().shortcut4TemplateMenu());
} }
} }
@ -183,7 +182,7 @@ public class NewJForm extends JForm {
private void processColumnAbsorbingEffect(XWTitleLayout xwTitleLayout, DynamicUnitList columnUnitList, Dimension bound) { private void processColumnAbsorbingEffect(XWTitleLayout xwTitleLayout, DynamicUnitList columnUnitList, Dimension bound) {
int temp = 0; int temp = 0;
int resolution = DesignerUIModeConfig.getInstance().getScreenResolution();; int resolution = DesignerUIModeConfig.getInstance().getScreenResolution();
int difference = 0; int difference = 0;
int i = 0; int i = 0;
while (true) { while (true) {
@ -207,7 +206,7 @@ public class NewJForm extends JForm {
private void processRowAbsorbingEffect(XWTitleLayout xwTitleLayout, DynamicUnitList rowUnitList, Dimension bound) { private void processRowAbsorbingEffect(XWTitleLayout xwTitleLayout, DynamicUnitList rowUnitList, Dimension bound) {
int temp = hasTitle(xwTitleLayout) ? TITLE_HEIGHT : 0; int temp = hasTitle(xwTitleLayout) ? TITLE_HEIGHT : 0;
int resolution =DesignerUIModeConfig.getInstance().getScreenResolution(); int resolution = DesignerUIModeConfig.getInstance().getScreenResolution();
int difference = 0; int difference = 0;
int i = 0; int i = 0;
while (true) { while (true) {

6
designer-form/src/main/java/com/fr/design/mainframe/JForm.java

@ -597,7 +597,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
} }
private ShortCut getReportFitAttrAction() { protected ShortCut getReportFitAttrAction() {
FormAdaptiveConfigUIProcessor adaptiveConfigUI = ExtraDesignClassManager.getInstance().getSingle(FormAdaptiveConfigUIProcessor.MARK_STRING); FormAdaptiveConfigUIProcessor adaptiveConfigUI = ExtraDesignClassManager.getInstance().getSingle(FormAdaptiveConfigUIProcessor.MARK_STRING);
if (adaptiveConfigUI != null) { if (adaptiveConfigUI != null) {
return adaptiveConfigUI.getConfigShortCut(this); return adaptiveConfigUI.getConfigShortCut(this);
@ -824,7 +824,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
provider.onClick(JForm.this); provider.onClick(JForm.this);
} }
}); });
if(StringUtils.isNotEmpty(provider.tooltipForPopItem())){ if (StringUtils.isNotEmpty(provider.tooltipForPopItem())) {
item.setToolTipText(provider.tooltipForPopItem()); item.setToolTipText(provider.tooltipForPopItem());
} }
menuItems.add(item); menuItems.add(item);
@ -1188,7 +1188,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
FormArea formArea = formDesign.getArea(); FormArea formArea = formDesign.getArea();
int horizontalValue = formArea.getHorizontalValue(); int horizontalValue = formArea.getHorizontalValue();
int verticalValue= formArea.getVerticalValue(); int verticalValue = formArea.getVerticalValue();
Dimension areaSize = formArea.getAreaSize(); Dimension areaSize = formArea.getAreaSize();
double widthValue = formArea.getWidthPaneValue(); double widthValue = formArea.getWidthPaneValue();
double heightValue = formArea.getHeightPaneValue(); double heightValue = formArea.getHeightPaneValue();

10
designer-realize/src/main/java/com/fr/design/webattr/ServerFitAttrPane.java

@ -1,6 +1,8 @@
package com.fr.design.webattr; package com.fr.design.webattr;
import com.fr.config.Configuration; import com.fr.config.Configuration;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.report.fit.BaseFitAttrPane; import com.fr.design.report.fit.BaseFitAttrPane;
import com.fr.design.report.fit.FitAttrModel; import com.fr.design.report.fit.FitAttrModel;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
@ -9,6 +11,7 @@ import com.fr.report.fit.ReportFitConfig;
import com.fr.transaction.Configurations; import com.fr.transaction.Configurations;
import com.fr.transaction.Worker; import com.fr.transaction.Worker;
import java.awt.Color;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
@ -74,5 +77,12 @@ public class ServerFitAttrPane extends BaseFitAttrPane {
} }
}; };
} }
@Override
protected void initPrompt() {
UILabel uiLabel = new UILabel(Toolkit.i18nText("Fine-Designer_Fit_Attr_Pane_Hint"));
uiLabel.setForeground(Color.lightGray);
contentJPanel.add(uiLabel);
}
} }

Loading…
Cancel
Save