diff --git a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
index f00e1a8558..48f05f7e2c 100644
--- a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
+++ b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
@@ -91,6 +91,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private static final String VERSION100 = "100";
private static final int CACHINGTEMPLATE_LIMIT = 5;
private static final String WEB_NAME = "webapps";
+ public static final int LAYOUT_TEMPLATE_SIMPLE_STYLE = 0;
+ public static final int LAYOUT_TEMPLATE_REAL_STYLE = 1;
/**
* 指定默认工作空间
*/
@@ -205,6 +207,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private boolean showTemplateMissingPlugin = true;
+ private int layoutTemplateStyle = LAYOUT_TEMPLATE_SIMPLE_STYLE;
+
/**
* DesignerEnvManager.
*/
@@ -1691,6 +1695,14 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
this.openDebug = openDebug;
}
+ public int getLayoutTemplateStyle() {
+ return layoutTemplateStyle;
+ }
+
+ public void setLayoutTemplateStyle(int layoutTemplateStyle) {
+ this.layoutTemplateStyle = layoutTemplateStyle;
+ }
+
/**
* Read XML.
* The method will be invoked when read data from XML file.
@@ -1861,6 +1873,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
this.setEmbedServerLazyStartup(reader.getAttrAsBoolean("embedServerLazyStartup", false));
this.setShowTemplateMissingPlugin(reader.getAttrAsBoolean("showTemplateMissingPlugin", true));
this.setShowServerDatasetAuthTip(reader.getAttrAsBoolean("showServerDatasetAuthTip", true));
+ this.setLayoutTemplateStyle(reader.getAttrAsInt("layoutTemplateStyle", LAYOUT_TEMPLATE_SIMPLE_STYLE));
}
private void readReportPaneAttributions(XMLableReader reader) {
@@ -2134,6 +2147,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
if (!this.isShowTemplateMissingPlugin()) {
writer.attr("showTemplateMissingPlugin", this.isShowTemplateMissingPlugin());
}
+ writer.attr("layoutTemplateStyle", this.getLayoutTemplateStyle());
writer.attr("showServerDatasetAuthTip", this.isShowServerDatasetAuthTip());
writer.end();
}
diff --git a/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java b/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java
index fdfdc31b5b..1457f0d111 100644
--- a/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java
+++ b/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java
@@ -88,7 +88,6 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS
}
protected void renameConnection(final String oldName, final String newName) {
- tableDataConfig.renameTableData(oldName, newName);
StrategyEventsNotifier.modifyDataSet(DSMapping.ofServerDS(new DsNameTarget(oldName)));
}
};
diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java
index 32bd070d95..a16c16e24d 100644
--- a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java
+++ b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java
@@ -251,7 +251,7 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
try {
WorkContext.getCurrent().get(TableDataOperator.class).saveTableData(tableDataBeans);
if (!WorkContext.getCurrent().isLocal()) {
- EventDispatcher.fire(RemoteConfigEvent.EDIT, TableDataConfig.class.getSimpleName());
+ EventDispatcher.fire(RemoteConfigEvent.EDIT, TableDataConfig.getInstance().getNameSpace());
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java
index 0850cf05a1..6a9c2d1edb 100644
--- a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java
+++ b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java
@@ -186,10 +186,12 @@ public class TableDataTreePane extends BasicTableDataTreePane {
for (int i = 0; i < lineTips.length; i++) {
String lineTip = lineTips[i];
List jLabels = new ArrayList<>();
- jLabels.add(new JLabel(lineTip));
+ JLabel lineJLabel = new JLabel(lineTip);
+ lineJLabel.setForeground(Color.lightGray);
+ jLabels.add(lineJLabel);
if (i == (lineTips.length - 1)) {
JLabel jLabel = new JLabel(Toolkit.i18nText("Fine-Design_Basic_Alphafine_No_Remind"));
- jLabel.setForeground(Color.lightGray);
+ jLabel.setForeground(Color.blue);
jLabel.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java
index 018aa8f4c8..4ce851295d 100644
--- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java
+++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java
@@ -182,7 +182,7 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
try {
WorkContext.getCurrent().get(ConnectionOperator.class).saveConnection(connectionBeans);
if (!WorkContext.getCurrent().isLocal()) {
- EventDispatcher.fire(RemoteConfigEvent.EDIT, ConnectionConfig.class.getSimpleName());
+ EventDispatcher.fire(RemoteConfigEvent.EDIT, ConnectionConfig.getInstance().getNameSpace());
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
@@ -197,11 +197,6 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
ConnectionConfig cloned = connectionConfig.mirror();
populate(cloned);
}
-
- @Override
- protected void renameConnection(String oldName, String newName) {
- connectionConfig.renameConnection(oldName, newName);
- }
};
final BasicDialog connectionListDialog = connectionManagerPane.showLargeWindow(parent, null);
connectionListDialog.addDialogActionListener(new ConnectionListDialogActionAdapter(connectionManagerPane, connectionListDialog, connectionConfig));
diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java
index 381a9cd761..a9321879c8 100644
--- a/designer-base/src/main/java/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java
+++ b/designer-base/src/main/java/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java
@@ -24,6 +24,16 @@ public abstract class AbstractAttrNoScrollPane extends BasicPane {
private AttributeChangeListener listener;
private String globalName = "";
+ private boolean autoFireAttributesChanged = true;
+
+ public boolean isAutoFireAttributesChanged() {
+ return this.autoFireAttributesChanged;
+ }
+
+ public void setAutoFireAttributesChanged(boolean autoFireAttributesChanged) {
+ this.autoFireAttributesChanged = autoFireAttributesChanged;
+ }
+
protected AbstractAttrNoScrollPane() {
initAll();
}
@@ -127,7 +137,9 @@ public abstract class AbstractAttrNoScrollPane extends BasicPane {
public void attributeChanged() {
synchronized (this) {
if (listener != null) {
- listener.attributeChange();
+ if (autoFireAttributesChanged) {
+ listener.attributeChange();
+ }
}
}
}
diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/AttributeChangeUtils.java b/designer-base/src/main/java/com/fr/design/gui/frpane/AttributeChangeUtils.java
new file mode 100644
index 0000000000..bfc1ff9d45
--- /dev/null
+++ b/designer-base/src/main/java/com/fr/design/gui/frpane/AttributeChangeUtils.java
@@ -0,0 +1,47 @@
+package com.fr.design.gui.frpane;
+
+import java.awt.Component;
+import java.awt.Container;
+
+/**
+ * @author Starryi
+ * @version 1.0
+ * Created by Starryi on 2021/9/17
+ */
+public class AttributeChangeUtils {
+ private static AbstractAttrNoScrollPane findNearestAttrNoScrollPaneAncestor(Component c) {
+ for(Container p = c.getParent(); p != null; p = p.getParent()) {
+ if (p instanceof AbstractAttrNoScrollPane) {
+ return (AbstractAttrNoScrollPane) p;
+ }
+ }
+ return null;
+ }
+
+ public static void changeComposedUI(Component composedComponent, boolean fireMiddleStateChanged, UIChangeAction action) {
+ AbstractAttrNoScrollPane attrPane = findNearestAttrNoScrollPaneAncestor(composedComponent);
+ boolean oldAutoFire = true;
+
+ if (!fireMiddleStateChanged) {
+ // 禁止属性面板自动处理属性更新
+ if (attrPane != null) {
+ oldAutoFire = attrPane.isAutoFireAttributesChanged();
+ attrPane.setAutoFireAttributesChanged(false);
+ }
+ }
+
+ // 更新UI
+ action.changeComposedUI();
+
+ if (!fireMiddleStateChanged) {
+ // 恢复属性面板自动处理属性更新
+ if (attrPane != null) {
+ attrPane.setAutoFireAttributesChanged(oldAutoFire);
+ }
+ }
+ }
+
+ public interface UIChangeAction {
+ void changeComposedUI();
+ }
+}
\ No newline at end of file
diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java
index 624e2e8ee8..34a7a0012b 100644
--- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java
+++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java
@@ -37,6 +37,8 @@ public class UIButtonGroup extends JPanel implements GlobalNameObserver {
private boolean isToolBarComponent = false;
private boolean isClick;
+ private boolean autoFireStateChanged = true;
+
public UIButtonGroup(String[] textArray) {
this(textArray, null);
}
@@ -72,7 +74,7 @@ public class UIButtonGroup extends JPanel implements GlobalNameObserver {
if (globalNameListener != null) {
globalNameListener.setGlobalName(buttonGroupName);
}
- setSelectedWithFireChanged(index);
+ setSelectedIndex(index, autoFireStateChanged);
}
};
}
@@ -108,7 +110,7 @@ public class UIButtonGroup extends JPanel implements GlobalNameObserver {
if (globalNameListener != null) {
globalNameListener.setGlobalName(buttonGroupName);
}
- setSelectedWithFireChanged(index);
+ setSelectedIndex(index, autoFireStateChanged);
}
};
}
@@ -175,7 +177,7 @@ public class UIButtonGroup extends JPanel implements GlobalNameObserver {
if (globalNameListener != null) {
globalNameListener.setGlobalName(buttonGroupName);
}
- setSelectedWithFireChanged(index);
+ setSelectedIndex(index, autoFireStateChanged);
}
};
}
@@ -253,6 +255,10 @@ public class UIButtonGroup extends JPanel implements GlobalNameObserver {
g2d.setClip(oldClip);
}
+ public void setAutoFireStateChanged(boolean autoFireStateChanged) {
+ this.autoFireStateChanged = autoFireStateChanged;
+ }
+
/**
* setSelectedItem
*
@@ -287,13 +293,14 @@ public class UIButtonGroup extends JPanel implements GlobalNameObserver {
return selectedIndex;
}
- protected void setSelectedWithFireChanged(int newSelectedIndex) {
- selectedIndex = newSelectedIndex;
- for (int i = 0; i < labelButtonList.size(); i++) {
- if (i == selectedIndex) {
- labelButtonList.get(i).setSelectedWithFireListener(true);
- } else {
- labelButtonList.get(i).setSelected(false);
+ protected void setSelectedIndex(int newSelectedIndex, boolean fireChanged) {
+ if (selectedIndex != newSelectedIndex) {
+ selectedIndex = newSelectedIndex;
+ for (int i = 0; i < labelButtonList.size(); i++) {
+ labelButtonList.get(i).setSelected(i == selectedIndex, false);
+ }
+ if (fireChanged) {
+ fireStateChanged();
}
}
}
@@ -304,10 +311,7 @@ public class UIButtonGroup extends JPanel implements GlobalNameObserver {
* @param newSelectedIndex
*/
public void setSelectedIndex(int newSelectedIndex) {
- selectedIndex = newSelectedIndex;
- for (int i = 0; i < labelButtonList.size(); i++) {
- labelButtonList.get(i).setSelected(i == selectedIndex);
- }
+ setSelectedIndex(newSelectedIndex, true);
}
private void fireStateChanged() {
diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UITabGroup.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UITabGroup.java
index 69f5845f1d..1d74d2e1d3 100644
--- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UITabGroup.java
+++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UITabGroup.java
@@ -63,13 +63,8 @@ public class UITabGroup extends UIButtonGroup {
}
@Override
- protected void setSelectedWithFireChanged(int newSelectedIndex) {
- if (selectedIndex != newSelectedIndex) {
- selectedIndex = newSelectedIndex;
- for (int i = 0; i < labelButtonList.size(); i++) {
- labelButtonList.get(i).setSelected(i == selectedIndex);
- }
- }
+ protected void setSelectedIndex(int newSelectedIndex, boolean fireChanged) {
+ super.setSelectedIndex(newSelectedIndex, fireChanged);
tabChanged(newSelectedIndex);
}
}
\ No newline at end of file
diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIToggleButton.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIToggleButton.java
index dc380c0c94..18764e9119 100644
--- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIToggleButton.java
+++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIToggleButton.java
@@ -142,10 +142,12 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
}
}
- public void setSelectedWithFireListener(boolean isSelected) {
+ public void setSelected(boolean isSelected, boolean fireChanged) {
if (this.isSelected != isSelected) {
this.isSelected = isSelected;
- fireSelectedChanged();
+ if (fireChanged) {
+ fireSelectedChanged();
+ }
refresh(isSelected);
}
}
@@ -175,7 +177,7 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
@Override
public void mouseClicked(MouseEvent e) {
if (isEnabled() && !isEventBannded) {
- setSelectedWithFireListener(!isSelected());
+ setSelected(!isSelected(), true);
}
}
};
diff --git a/designer-base/src/main/java/com/fr/design/gui/style/FollowingThemePane.java b/designer-base/src/main/java/com/fr/design/gui/style/FollowingThemePane.java
index f9f556b3d3..bf06aa2fd7 100644
--- a/designer-base/src/main/java/com/fr/design/gui/style/FollowingThemePane.java
+++ b/designer-base/src/main/java/com/fr/design/gui/style/FollowingThemePane.java
@@ -5,6 +5,7 @@ import com.fr.design.dialog.BasicPane;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.design.file.HistoryTemplateListCache;
+import com.fr.design.gui.frpane.AttributeChangeUtils;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
@@ -47,16 +48,20 @@ public class FollowingThemePane extends BasicPane implements UIObserver {
this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
followingThemeButtonGroup = new UIButtonGroup<>(FOLLOWING_THEME_STRING_ARRAYS);
+ followingThemeButtonGroup.setAutoFireStateChanged(false);
followingThemeButtonGroup.setSelectedIndex(1);
followingThemeButtonGroup.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
- for (FollowingThemeActionChangeListener changeListener : changeListeners) {
- changeListener.onFollowingTheme(isFollowingTheme());
- }
- invalidate();
-
- // 与主题相关的属性面板更新完毕后,再通知外层更新数据
+ AttributeChangeUtils.changeComposedUI(FollowingThemePane.this, false, new AttributeChangeUtils.UIChangeAction() {
+ @Override
+ public void changeComposedUI() {
+ for (FollowingThemeActionChangeListener changeListener : changeListeners) {
+ changeListener.onFollowingTheme(isFollowingTheme());
+ }
+ invalidate();
+ }
+ });
if (uiObserverListener != null) {
uiObserverListener.doChange();
}
diff --git a/designer-base/src/main/java/com/fr/design/javascript/ExportJavaScriptPane.java b/designer-base/src/main/java/com/fr/design/javascript/ExportJavaScriptPane.java
index ba64b4d4d7..b559c22e6e 100644
--- a/designer-base/src/main/java/com/fr/design/javascript/ExportJavaScriptPane.java
+++ b/designer-base/src/main/java/com/fr/design/javascript/ExportJavaScriptPane.java
@@ -50,9 +50,9 @@ import javax.swing.event.ChangeEvent;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import javax.swing.table.TableCellEditor;
+import javax.swing.table.TableCellRenderer;
import java.awt.BorderLayout;
import java.awt.CardLayout;
-import java.awt.Color;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@@ -86,6 +86,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane {
+ if (e.getStateChange() == ItemEvent.SELECTED) {
+ final int row = table.getSelectedRow();
+ if (row == -1) {
+ return;
+ }
+ SingleJavaScript js = getList().get(row);
+ Object ob = parameterSetting.getSelectedItem();
+ if (ob != null) {
+ String value = ob.toString();
+ js.setExtendParameters(StringUtils.equals(value, DEFAULT));
+ }
+ // 单纯为了刷新表格,使某些联动生效
+ table.repaint();
+ }
+ });
this.addCellEditorListener(new CellEditorListener() {
@Override
@@ -540,15 +561,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane(Arrays.asList((ParameterProvider[]) value)));
+ if (getList().get(row) == null || getList().get(row).isExtendParameters()) {
+ return EMPTY_LABEL;
+ }
+ ParameterProvider[] providers = (ParameterProvider[]) value;
+ if (providers != null) {
+ paraSettingPane.refresh(Arrays.asList(providers));
+ }
return paraButton;
}
@@ -624,6 +642,14 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane parameterList = this.parameterViewPane.update();
- parameterList.clear();
- ParameterProvider[] parameters = js.getParameters();
- this.parameterViewPane.populate(parameters);
+ if (this.parameterViewPane != null) {
+ List parameterList = this.parameterViewPane.update();
+ parameterList.clear();
+ ParameterProvider[] parameters = js.getParameters();
+ this.parameterViewPane.populate(parameters);
+ }
}
} else {
OtherTemplatePane pane = (OtherTemplatePane) this.templatePanel.getComponent(1);
diff --git a/designer-base/src/main/java/com/fr/design/mainframe/guide/base/GuideView.java b/designer-base/src/main/java/com/fr/design/mainframe/guide/base/GuideView.java
index aa277adbbf..7e141d7d55 100644
--- a/designer-base/src/main/java/com/fr/design/mainframe/guide/base/GuideView.java
+++ b/designer-base/src/main/java/com/fr/design/mainframe/guide/base/GuideView.java
@@ -124,6 +124,6 @@ public class GuideView extends JDialog {
private void updateGuideViewLocation() {
GUICoreUtils.centerWindow(window, this);
- this.setSize(getSize());
+ this.setBounds(window.getBounds());
}
}
diff --git a/designer-base/src/main/java/com/fr/design/mainframe/guide/scene/AbstractGuideScene.java b/designer-base/src/main/java/com/fr/design/mainframe/guide/scene/AbstractGuideScene.java
index 240244fff2..95c7c24a4a 100644
--- a/designer-base/src/main/java/com/fr/design/mainframe/guide/scene/AbstractGuideScene.java
+++ b/designer-base/src/main/java/com/fr/design/mainframe/guide/scene/AbstractGuideScene.java
@@ -9,6 +9,7 @@ import com.fr.design.mainframe.guide.tip.BubbleTip;
import com.fr.design.mainframe.guide.tip.GuideTip;
import com.fr.stable.StringUtils;
+import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.JPanel;
@@ -21,6 +22,7 @@ import java.awt.Composite;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
+import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Window;
@@ -33,6 +35,7 @@ import java.util.List;
public abstract class AbstractGuideScene extends JPanel implements GuideScene {
private static final int DEFAULT_ARROW_HEIGHT = 12;
private static final int DEFAULT_ARROW_WIDTH = 18;
+ public static final Insets DEFAULT_HIGHLIGHT_INSETS = new Insets(5, 5, 5, 5);
private GuideScene nextScene;
private SceneFilter sceneFilter;
@@ -169,9 +172,22 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
private UILabel getTargetComponentWithImage(BufferedImage image, Rectangle rectangle) {
ImageIcon ic = new ImageIcon(image);
- UILabel label = new UILabel(ic);
+ UILabel label = new UILabel(ic){
+ @Override
+ public Insets getInsets() {
+ return DEFAULT_HIGHLIGHT_INSETS;
+ }
+ };
+
+ label.setBorder(BorderFactory.createMatteBorder(DEFAULT_HIGHLIGHT_INSETS.top, DEFAULT_HIGHLIGHT_INSETS.left, DEFAULT_HIGHLIGHT_INSETS.bottom, DEFAULT_HIGHLIGHT_INSETS.right, Color.WHITE));
+
label.setOpaque(true);
- label.setBounds(rectangle);
+ label.setBounds(new Rectangle(
+ rectangle.x - DEFAULT_HIGHLIGHT_INSETS.left,
+ rectangle.y - DEFAULT_HIGHLIGHT_INSETS.top,
+ rectangle.width + DEFAULT_HIGHLIGHT_INSETS.left + DEFAULT_HIGHLIGHT_INSETS.right,
+ rectangle.height + DEFAULT_HIGHLIGHT_INSETS.top + DEFAULT_HIGHLIGHT_INSETS.bottom
+ ));
return label;
}
diff --git a/designer-base/src/main/java/com/fr/design/mainframe/guide/tip/BubbleTip.java b/designer-base/src/main/java/com/fr/design/mainframe/guide/tip/BubbleTip.java
index d3d1c040df..13e5dc28f0 100644
--- a/designer-base/src/main/java/com/fr/design/mainframe/guide/tip/BubbleTip.java
+++ b/designer-base/src/main/java/com/fr/design/mainframe/guide/tip/BubbleTip.java
@@ -2,8 +2,6 @@ package com.fr.design.mainframe.guide.tip;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.i18n.Toolkit;
-import com.fr.design.mainframe.DesignerContext;
-import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.mainframe.guide.base.Guide;
import com.fr.design.mainframe.guide.base.GuideManager;
import com.fr.design.mainframe.guide.ui.bubble.Bubble;
@@ -16,9 +14,11 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class BubbleTip implements GuideTip {
+ private static final int GAP = 5;
private BubbleWithClose bubbleBox;
private Point anchor;
+
/**
*
* @param title 标题
@@ -70,12 +70,12 @@ public class BubbleTip implements GuideTip {
int bubbleW = bubbleBox.getPreferredSize().width;
int bubbleH = bubbleBox.getPreferredSize().height;
if (bubbleBox.isTailHorizontal()) {
- int x = bubbleBox.isTailLeft() ? anchor.x : anchor.x - bubbleW;
+ int x = bubbleBox.isTailLeft() ? anchor.x + GAP : anchor.x - bubbleW - GAP;
int y = anchor.y - (int) (bubbleH * bubbleBox.getTailStart());
bubbleBox.setBounds(x, y, bubbleW, bubbleH);
} else if (bubbleBox.isTailVertical()) {
int x = anchor.x - (int) (bubbleW * bubbleBox.getTailStart());
- int y = bubbleBox.isTailTop() ? anchor.y : anchor.y - bubbleH;
+ int y = bubbleBox.isTailTop() ? anchor.y + GAP : anchor.y - bubbleH - GAP;
bubbleBox.setBounds(x, y, bubbleW, bubbleH);
}
}
diff --git a/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/BubbleHint.java b/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/BubbleHint.java
index 56f978731b..79d49d1925 100644
--- a/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/BubbleHint.java
+++ b/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/BubbleHint.java
@@ -17,6 +17,7 @@ import java.awt.event.ActionListener;
public class BubbleHint extends Bubble {
private UIButton confirmButton;
+ private static final Color CONTENT_TEXT_COLOR = new Color(51, 51, 52);
public BubbleHint() {
super(TailDirection.TOP, 0.9f);
@@ -38,21 +39,21 @@ public class BubbleHint extends Bubble {
title.setHorizontalAlignment(SwingConstants.CENTER);
title.setBorder(BorderFactory.createEmptyBorder(0,0,5,0));
- UILabel content1 = new UILabel(Toolkit.i18nText("Fine-Design_Guide_Tips_Content1"));
- content1.setPreferredSize(new Dimension(190,20));
- content1.setHorizontalAlignment(SwingConstants.CENTER);
+ UILabel content1 = createContentLabel(Toolkit.i18nText("Fine-Design_Guide_Tips_Content1"));
- UILabel content2 = new UILabel(Toolkit.i18nText("Fine-Design_Guide_Tips_Content2"));
- content2.setPreferredSize(new Dimension(190,20));
- content2.setHorizontalAlignment(SwingConstants.CENTER);
+ UILabel content2 = createContentLabel(Toolkit.i18nText("Fine-Design_Guide_Tips_Content2"));
JPanel buttonContainer= FRGUIPaneFactory.createCenterFlowZeroGapBorderPane();
- buttonContainer.setBorder(BorderFactory.createEmptyBorder(20, 0, 0, 0));
+ buttonContainer.setBorder(BorderFactory.createEmptyBorder(15, 0, 0, 0));
buttonContainer.setPreferredSize(new Dimension(190,40));
buttonContainer.setOpaque(false);
- confirmButton = new UIButton(Toolkit.i18nText("Fine-Design_Guide_Tips_Know"));
- confirmButton.setPreferredSize(new Dimension(78, 24));
+ confirmButton = new UIButton(Toolkit.i18nText("Fine-Design_Guide_Tips_Know")) {
+ public Dimension getPreferredSize() {
+ return new Dimension(78, 24);
+ }
+ };
+
buttonContainer.add(confirmButton);
contentPane.add(title);
@@ -71,4 +72,13 @@ public class BubbleHint extends Bubble {
confirmButton.removeActionListener(listener);
}
+ private UILabel createContentLabel(String text) {
+ UILabel content = new UILabel(text);
+ content.setPreferredSize(new Dimension(190,20));
+ content.setHorizontalAlignment(SwingConstants.CENTER);
+ content.setFont(content.getFont().deriveFont(14.0f));
+ content.setForeground(CONTENT_TEXT_COLOR);
+ return content;
+ }
+
}
diff --git a/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/ExpandPane.java b/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/ExpandPane.java
index c71a15ea7d..c4e6e01601 100644
--- a/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/ExpandPane.java
+++ b/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/ExpandPane.java
@@ -30,7 +30,7 @@ public class ExpandPane extends JPanel {
}
private void initComponent() {
- VerticalFlowLayout layout = new VerticalFlowLayout(VerticalFlowLayout.TOP, 10, 5);
+ VerticalFlowLayout layout = new VerticalFlowLayout(VerticalFlowLayout.TOP, 10, 0);
layout.setAlignLeft(true);
this.setLayout(layout);
@@ -47,7 +47,7 @@ public class ExpandPane extends JPanel {
private JPanel createHeader() {
headerPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
- headerPane.setPreferredSize(new Dimension(200, 24));
+ headerPane.setPreferredSize(new Dimension(200, 16));
UILabel headerTitle = new UILabel(this.title);
headerTitle.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
arrow = new UILabel(downIcon);
diff --git a/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideCompleteDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideCompleteDialog.java
index 29316652da..af1854d7af 100644
--- a/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideCompleteDialog.java
+++ b/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideCompleteDialog.java
@@ -14,7 +14,9 @@ import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JDialog;
import javax.swing.JPanel;
+import javax.swing.JTextPane;
import javax.swing.SwingConstants;
+import javax.swing.text.MutableAttributeSet;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyledDocument;
@@ -22,6 +24,7 @@ import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
+import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.Window;
import java.awt.event.ActionEvent;
@@ -34,12 +37,16 @@ public class GuideCompleteDialog extends JDialog {
private static final int ICON_HEIGHT = 182;
private static final Color FONT_COLOR = new Color(51, 51, 52);
private static final Color BUTTON_BG_COLOR = new Color(65, 155,249);
+ private static final Font TITLE_FONT = new Font(Font.SANS_SERIF, Font.BOLD, 22);
+ private static final Font CONTENT_FONT = new Font(Font.SANS_SERIF, Font.PLAIN, 18);
+ private static final Font BUTTON_FONT = new Font(Font.SANS_SERIF, Font.BOLD, 14);
private static GuideCompleteDialog dialog;
public static GuideCompleteDialog getInstance() {
if (dialog == null) {
dialog = new GuideCompleteDialog(DesignerContext.getDesignerFrame());
}
+ dialog = new GuideCompleteDialog(DesignerContext.getDesignerFrame());
return dialog;
}
@@ -65,15 +72,16 @@ public class GuideCompleteDialog extends JDialog {
container.setBorder(BorderFactory.createEmptyBorder(15, 52, 25, 52));
UILabel title = new UILabel(Toolkit.i18nText("Fine-Design_Guide_Complete_Confirm"));
- title.setFont(title.getFont().deriveFont(22.0f));
+ title.setFont(TITLE_FONT);
title.setPreferredSize(new Dimension(190, 30));
title.setHorizontalAlignment(SwingConstants.CENTER);
title.setForeground(FONT_COLOR);
textArea = new UITextPane();
+ changeLineSpacing(textArea, 0.19f,false);
textArea.setEnabled(false);
textArea.setOpaque(false);
- textArea.setFont(textArea.getFont().deriveFont(18.0f));
+ textArea.setFont(CONTENT_FONT);
textArea.setPreferredSize(new Dimension(236, 52));
textArea.setBorder(null);
textArea.setDisabledTextColor(FONT_COLOR);
@@ -83,7 +91,8 @@ public class GuideCompleteDialog extends JDialog {
doc.setParagraphAttributes(0, doc.getLength(), center, false);
JPanel buttonContainer= FRGUIPaneFactory.createCenterFlowZeroGapBorderPane();
- buttonContainer.setPreferredSize(new Dimension(190,38));
+ buttonContainer.setPreferredSize(new Dimension(190,43));
+ buttonContainer.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
buttonContainer.setOpaque(false);
UIButton button = new UIButton(Toolkit.i18nText("Fine-Design_Guide_Complete_End")){
@@ -92,6 +101,7 @@ public class GuideCompleteDialog extends JDialog {
return new Dimension(122, 38);
}
};
+ button.setFont(BUTTON_FONT);
button.setUI(confirmButtonUI);
button.setRoundBorder(true);
button.setForeground(Color.WHITE);
@@ -131,4 +141,11 @@ public class GuideCompleteDialog extends JDialog {
}
}
};
+
+ private void changeLineSpacing(JTextPane pane, float factor, boolean replace) {
+ pane.selectAll();
+ MutableAttributeSet set = new SimpleAttributeSet(pane.getParagraphAttributes());
+ StyleConstants.setLineSpacing(set, factor);
+ pane.setParagraphAttributes(set, replace);
+ }
}
diff --git a/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideManageDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideManageDialog.java
index 07059ad052..98ea4c3c6d 100644
--- a/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideManageDialog.java
+++ b/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideManageDialog.java
@@ -74,7 +74,7 @@ public class GuideManageDialog extends JDialog {
}
private JPanel createGuideVersionPane(GuideVersion guideVersion) {
- JPanel expandContent = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, VerticalFlowLayout.TOP, 0, 5);
+ JPanel expandContent = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, VerticalFlowLayout.TOP, 0, 10);
for (GuideGroup guideGroup : guideVersion.getGuideGroupList()) {
JPanel guideGroupCard = createGuideGroupCard(guideGroup);
expandContent.add(guideGroupCard);
diff --git a/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/bubble/BubbleWithClose.java b/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/bubble/BubbleWithClose.java
index ba8f3da05d..62e0ed65d0 100644
--- a/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/bubble/BubbleWithClose.java
+++ b/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/bubble/BubbleWithClose.java
@@ -9,6 +9,7 @@ import com.fr.stable.StringUtils;
import javax.swing.Icon;
import javax.swing.JTextPane;
+import javax.swing.text.MutableAttributeSet;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyledDocument;
@@ -18,7 +19,6 @@ import java.awt.Container;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
-import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.LayoutManager;
import java.awt.Rectangle;
@@ -32,13 +32,21 @@ import java.text.AttributedCharacterIterator;
import java.text.AttributedString;
public class BubbleWithClose extends Bubble {
- private static final Font FONT = new Font(Font.SANS_SERIF, Font.PLAIN, 14);
+ private static final Font TITLE_FONT = new Font(Font.SANS_SERIF, Font.PLAIN, 14);
+ private static final Font CONTENT_FONT = new Font(Font.SANS_SERIF, Font.PLAIN, 12);
+ private static final int TITLE_LINE_HEIGHT = 22;
+ private static final int CONTENT_LINE_HEIGHT = 18;
+
private static final Icon ICON = IOUtils.readIcon("/com/fr/design/mainframe/guide/close.png");
- private static final int HEADER_HEIGHT = 24;
- private static final Color HEADER_COLOR = new Color(245, 245, 246);
private static final Color TITLE_COLOR = new Color(51, 51, 52);
private static final Color CONTENT_COLOR = new Color(51,51,52,128);
- private static final Insets DEFAULT_INSET = new Insets(10, 15, 10, 15);
+ private static final Color HIGHLIGHT_COLOR = new Color(65, 155, 249);
+ private static final Insets DEFAULT_INSET = new Insets(15, 15, 15, 15);
+ private static final int MIN_WIDTH = 140;
+ private static final int MAX_WIDTH = 275;
+ private static final int ICON_GAP = 10;
+ private static final int ICON_SIZE = 10;
+ private static final int TEXT_GAP = 5;
private String title;
@@ -46,6 +54,8 @@ public class BubbleWithClose extends Bubble {
private UITextPane titleTextArea;
private UITextPane contentTextArea;
private UIButton closeButton;
+ private Dimension titleSize;
+ private Dimension contentSize;
public BubbleWithClose(String title, String content) {
this(title, content, TailDirection.LEFT, 0.5f);
@@ -87,23 +97,17 @@ public class BubbleWithClose extends Bubble {
@Override
public void componentResized(ComponentEvent e) {
Rectangle rectBounds = getRectBounds();
- Dimension buttonSize = closeButton.getPreferredSize();
-
- closeButton.setBounds(getWidth() - 10 - buttonSize.width, rectBounds.y + (HEADER_HEIGHT - buttonSize.height) / 2, buttonSize.width, buttonSize.height);
- Dimension titleSize = new Dimension(0,0);
- Dimension contentSize = new Dimension(0, 0);
+ closeButton.setBounds(rectBounds.x + rectBounds.width - DEFAULT_INSET.right - ICON_SIZE, rectBounds.y + 21, ICON_SIZE, ICON_SIZE);
if (titleTextArea != null) {
- titleSize = calTextSize(titleTextArea, getTextAreaMaxWidth());
- int x = rectBounds.x + (rectBounds.width - getHorizontalInsets() - titleSize.width) / 2 + DEFAULT_INSET.left;
- int y = rectBounds.y + HEADER_HEIGHT + DEFAULT_INSET.top;
+ int x = rectBounds.x + DEFAULT_INSET.left;
+ int y = rectBounds.y + DEFAULT_INSET.top;
titleTextArea.setBounds(x, y, titleSize.width, titleSize.height);
}
if (contentTextArea != null) {
- contentSize = calTextSize(contentTextArea, getTextAreaMaxWidth());
- int x = rectBounds.x + (rectBounds.width - getHorizontalInsets() - contentSize.width) / 2 + DEFAULT_INSET.left;
- int y = rectBounds.y = HEADER_HEIGHT + DEFAULT_INSET.top + (titleSize.height == 0 ? 0 : titleSize.height + 10);
+ int x = rectBounds.x + DEFAULT_INSET.left;
+ int y = rectBounds.y + DEFAULT_INSET.top + (titleSize.height == 0 ? 0 : titleSize.height + getTextGap());
contentTextArea.setBounds(x,y, contentSize.width, contentSize.height);
}
setSize(getPreferredSize().width, getPreferredSize().height);
@@ -116,7 +120,7 @@ public class BubbleWithClose extends Bubble {
closeButton = new UIButton();
closeButton.setIcon(ICON);
closeButton.set4ToolbarButton();
- closeButton.setPreferredSize(new Dimension(12, 12));
+ closeButton.setPreferredSize(new Dimension(ICON_SIZE, ICON_SIZE));
closeButton.setRolloverEnabled(false);
closeButton.setPressedPainted(false);
this.add(closeButton);
@@ -138,44 +142,84 @@ public class BubbleWithClose extends Bubble {
private void createTitleTextArea() {
if (StringUtils.isNotEmpty(title)) {
- titleTextArea = createTextArea(title, FONT, TITLE_COLOR);
+ titleTextArea = createTextArea(title, TITLE_FONT, TITLE_LINE_HEIGHT, TITLE_COLOR);
this.add(titleTextArea);
}
-
+ titleSize = calTextSize(titleTextArea, TITLE_LINE_HEIGHT, getTextAreaWidth(MAX_WIDTH), getTextAreaWidth(MIN_WIDTH));
}
private void createContentTextArea() {
if (StringUtils.isNotEmpty(content)) {
- contentTextArea = createTextArea(content, FONT, CONTENT_COLOR);
+ contentTextArea = createTextArea(content, CONTENT_FONT, CONTENT_LINE_HEIGHT, CONTENT_COLOR);
this.add(contentTextArea);
}
+ contentSize = calTextSize(contentTextArea, CONTENT_LINE_HEIGHT, getTextAreaWidth(MAX_WIDTH), getTextAreaWidth(MIN_WIDTH));
}
- private UITextPane createTextArea(String str, Font font, Color foreground) {
+ private UITextPane createTextArea(String str, Font font, int lineHeight, Color foreground) {
+ int lineSpace = lineHeight - font.getSize();
UITextPane textArea= new UITextPane(){
@Override
public Insets getInsets() {
- return new Insets(0, 0, 0, 0);
+ return new Insets(lineSpace / 2 - 1, 0, lineSpace / 2, 0);
}
};
- textArea.setText(str);
- textArea.setEnabled(false);
+ textArea.setFont(font);
+ changeLineSpacing(textArea, lineHeight, true);
+ textArea.setEditable(false);
+ textArea.setForeground(foreground);
textArea.setDisabledTextColor(foreground);
textArea.setBorder(null);
- textArea.setFont(font);
textArea.setOpaque(false);
- textArea.setForeground(foreground);
- StyledDocument doc = textArea.getStyledDocument();
- SimpleAttributeSet center = new SimpleAttributeSet();
- StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER);
- doc.setParagraphAttributes(0, doc.getLength(), center, false);
+ textArea.setText(str);
+ highlightText(textArea);
return textArea;
}
+ private void changeLineSpacing(JTextPane pane, int lineHeight, boolean replace) {
+ pane.selectAll();
+ MutableAttributeSet set = new SimpleAttributeSet(pane.getParagraphAttributes());
+ FontMetrics fontMetrics = GraphHelper.getFontMetrics(pane.getFont());
+ StyleConstants.setLineSpacing(set, (float)(lineHeight - fontMetrics.getHeight()) / fontMetrics.getHeight());
+ pane.setParagraphAttributes(set, replace);
+ }
+
+ private void highlightText(JTextPane textArea) {
+ SimpleAttributeSet sas = new SimpleAttributeSet();
+ StyleConstants.setForeground(sas, HIGHLIGHT_COLOR);
+ StyledDocument doc = textArea.getStyledDocument();
+ String text = textArea.getText();
+ int startPos = -1;
+ for (int i = 0; i < text.length(); i ++) {
+ char ch = text.charAt(i);
+ if (ch == '【') {
+ startPos = i;
+ }
+ if (ch == '】') {
+ if (startPos > 0) {
+ try {
+ doc.setCharacterAttributes(startPos, (i - startPos + 1), sas, false);
+ startPos = -1;
+ } catch (Exception e) {
+ }
+ }
+ }
+ }
+
+ }
+
+ @Override
+ protected int getDefaultWidth() {
+ return Math.max(titleSize.width, contentSize.width) + getHorizontalInsets() + ICON_GAP + ICON_SIZE + (isTailHorizontal() ? TAIL_HEIGHT : 0) ;
+ }
+
+ @Override
protected int getDefaultHeight() {
- Dimension titleSize = calTextSize(titleTextArea, getDefaultTextAreaMaxWidth());
- Dimension contentSize = calTextSize(contentTextArea, getDefaultTextAreaMaxWidth());
- return (isTailVertical() ? TAIL_HEIGHT : 0) + HEADER_HEIGHT + titleSize.height + (titleSize.height == 0 ? 0 : 5) + contentSize.height + getVerticalInsets();
+ return titleSize.height + contentSize.height + getTextGap() + getVerticalInsets() + (isTailVertical() ? TAIL_HEIGHT : 0);
+ }
+
+ private int getTextGap() {
+ return (titleSize.height != 0 && contentSize.height != 0) ? TEXT_GAP : 0;
}
private LayoutManager getLayoutManager() {
@@ -206,18 +250,6 @@ public class BubbleWithClose extends Bubble {
};
}
- @Override
- protected void paintBubbleBg(Graphics2D g2) {
- super.paintBubbleBg(g2);
- paintHeaderBg(g2);
- }
-
- private void paintHeaderBg(Graphics2D g2) {
- g2.setColor(HEADER_COLOR);
- Rectangle bounds = getRectBounds();
- g2.fillRoundRect(bounds.x, bounds.y, bounds.width, HEADER_HEIGHT, 10, 10);
- }
-
private int countLines(JTextPane textArea, int max_width) {
AttributedString text = new AttributedString(textArea.getText());
text.addAttribute(TextAttribute.FONT, textArea.getFont());
@@ -234,28 +266,26 @@ public class BubbleWithClose extends Bubble {
return lines;
}
- private Dimension calTextSize(JTextPane textArea, int maxWidth) {
+ private Dimension calTextSize(JTextPane textArea, int lineHeight, int maxWidth, int minWidth) {
if (textArea == null) {
- return new Dimension(0, 0);
+ return new Dimension(minWidth, 0);
}
FontMetrics fontMetrics = GraphHelper.getFontMetrics(textArea.getFont());
int line = countLines(textArea, maxWidth);
int width = maxWidth;
if (line == 1) {
- width = fontMetrics.stringWidth(textArea.getText());
+ width = Math.max(fontMetrics.stringWidth(textArea.getText()), minWidth);
}
- int height = fontMetrics.getHeight() * line;
+ int height = lineHeight * line;
return new Dimension(width, height);
}
- private int getTextAreaMaxWidth() {
- return getWidth() - (isTailHorizontal() ? TAIL_HEIGHT : 0) -getHorizontalInsets();
- }
- private int getDefaultTextAreaMaxWidth() {
- return BUBBLE_WIDTH - getHorizontalInsets();
+ private int getTextAreaWidth(int bubbleWidth) {
+ return bubbleWidth - getHorizontalInsets() - ICON_SIZE - ICON_GAP;
}
+
private int getHorizontalInsets() {
return DEFAULT_INSET.left + DEFAULT_INSET.right;
}
diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeEditorPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeEditorPane.java
index c2e28332d3..e924080ef6 100644
--- a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeEditorPane.java
+++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeEditorPane.java
@@ -267,6 +267,10 @@ public abstract class TemplateThemeEditorPane extends J
return nameTextField.checkValid();
}
+ public String getThemeName() {
+ return nameTextField.getText();
+ }
+
public List getCurrentColorScheme() {
return colorListPane.update();
}
diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java
index f3187acaab..4fc65badbd 100644
--- a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java
+++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java
@@ -60,6 +60,8 @@ public abstract class TemplateThemeProfilePane extends
private UIButton saveButton = new UIButton();
private UIButton saveAsButton = new UIButton();
+ private TemplateThemeProfileActionListener actionListener = new TemplateThemeProfileActionAdapter();
+
public TemplateThemeProfilePane(TemplateThemeConfig config) {
super();
this.config = config;
@@ -112,6 +114,7 @@ public abstract class TemplateThemeProfilePane extends
return;
}
saveButton.setEnabled(valid && isMutable);
+ actionListener.onThemeNameChecked(themeEditorPane.getThemeName(), valid);
}
});
@@ -138,6 +141,7 @@ public abstract class TemplateThemeProfilePane extends
if (saveAsButton != null) {
saveAsButton.setEnabled(StringUtils.isNotEmpty(name));
}
+
isPopulating = false;
}
@@ -330,4 +334,19 @@ public abstract class TemplateThemeProfilePane extends
this.dispose();
}
}
+
+ public void addProfileActionListener(TemplateThemeProfileActionListener actionListener) {
+ if (actionListener != null) {
+ this.actionListener = actionListener;
+ }
+ }
+ public interface TemplateThemeProfileActionListener {
+
+ void onThemeNameChecked(String name, boolean valid);
+ }
+ public static class TemplateThemeProfileActionAdapter implements TemplateThemeProfileActionListener {
+
+ @Override
+ public void onThemeNameChecked(String name, boolean valid) { }
+ }
}
\ No newline at end of file
diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/ECReportPreviewPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/ECReportPreviewPane.java
index a933f39489..63d75449dc 100644
--- a/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/ECReportPreviewPane.java
+++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/ECReportPreviewPane.java
@@ -49,7 +49,7 @@ public class ECReportPreviewPane extends UINoOpaquePanel implements ThemePreview
public PreviewPane() {
this.setPreferredSize(new Dimension(517, 270));
- this.setBorder(BorderFactory.createEmptyBorder(7, 10, 5, 10));
+ this.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10));
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel northPane = createNorthPane();
diff --git a/designer-base/src/main/java/com/fr/design/report/fit/BaseFitAttrPane.java b/designer-base/src/main/java/com/fr/design/report/fit/BaseFitAttrPane.java
index dbf078b68d..2c38d597c4 100644
--- a/designer-base/src/main/java/com/fr/design/report/fit/BaseFitAttrPane.java
+++ b/designer-base/src/main/java/com/fr/design/report/fit/BaseFitAttrPane.java
@@ -5,6 +5,7 @@ import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
+import com.fr.design.i18n.DesignSizeI18nManager;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.report.fit.menupane.FitPreviewPane;
@@ -90,9 +91,9 @@ public abstract class BaseFitAttrPane extends BasicBeanPane {
}
for (int i = 0; i < columnSize.length; i++) {
if (i == 0) {
- columnSize[i] = 80;
+ columnSize[i] = DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.report.fit.firstColumn").getWidth();
} else {
- columnSize[i] = 100;
+ columnSize[i] = DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.report.fit.column").getWidth();
}
}
diff --git a/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java b/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java
index 36328d9bdd..c1dd3afd6e 100644
--- a/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java
+++ b/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java
@@ -4,6 +4,7 @@ import com.fr.design.actions.JTemplateAction;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.UIDialog;
+import com.fr.design.i18n.DesignSizeI18nManager;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
@@ -66,13 +67,13 @@ public class ReportFitAttrAction extends JTemplateAction {
private void showReportFitDialog(ReportFitAttr fitAttr, final JTemplate jwb, final FitProvider wbTpl, final BasicBeanPane attrPane) {
attrPane.populateBean(fitAttr);
- UIDialog dialog = attrPane.showMediumWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
+ UIDialog dialog = attrPane.showWindowWithCustomSize(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override
public void doOk() {
wbTpl.setReportFitAttr(attrPane.updateBean());
jwb.fireTargetModified();
}
- });
+ }, DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.report.fit.templatePane.dialog"));
dialog.setVisible(true);
}
diff --git a/designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties b/designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties
index b69ede5ea8..686c3da8a8 100644
--- a/designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties
+++ b/designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties
@@ -8,4 +8,8 @@ com.fr.design.version.check.dialog=490*95
com.fr.design.version.detail.label=750*30
com.fr.design.version.detail.dialog=900*500
com.fr.env.SyncFailedPluginsDialog.messageWithLink=316*36
-com.fr.design.web.pane.text.field=450*20
\ No newline at end of file
+com.fr.design.web.pane.text.field=450*20
+com.fr.design.actions.server.dialog=800*630
+com.fr.design.report.fit.templatePane.dialog=800*400
+com.fr.design.report.fit.firstColumn=120*20
+com.fr.design.report.fit.column=160*20
\ No newline at end of file
diff --git a/designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties b/designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties
index 7d09dee4d0..5937b272ae 100644
--- a/designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties
+++ b/designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties
@@ -7,4 +7,8 @@ com.fr.design.version.check.dialog=430*95
com.fr.design.version.detail.label=650*30
com.fr.design.version.detail.dialog=800*500
com.fr.env.SyncFailedPluginsDialog.messageWithLink=316*36
-com.fr.design.web.pane.text.field=400*20
\ No newline at end of file
+com.fr.design.web.pane.text.field=400*20
+com.fr.design.actions.server.dialog=700*630
+com.fr.design.report.fit.templatePane.dialog=600*400
+com.fr.design.report.fit.firstColumn=170*20
+com.fr.design.report.fit.column=100*20
\ No newline at end of file
diff --git a/designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties b/designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties
index 28823bf1ad..5615b35556 100644
--- a/designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties
+++ b/designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties
@@ -7,4 +7,8 @@ com.fr.design.version.check.dialog=450*95
com.fr.design.version.detail.label=700*30
com.fr.design.version.detail.dialog=850*500
com.fr.env.SyncFailedPluginsDialog.messageWithLink=316*36
-com.fr.design.web.pane.text.field=450*20
\ No newline at end of file
+com.fr.design.web.pane.text.field=450*20
+com.fr.design.actions.server.dialog=700*630
+com.fr.design.report.fit.templatePane.dialog=600*400
+com.fr.design.report.fit.firstColumn=130*20
+com.fr.design.report.fit.column=100*20
\ No newline at end of file
diff --git a/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties b/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties
index 56998f7f7e..c507fcc083 100644
--- a/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties
+++ b/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties
@@ -8,4 +8,8 @@ com.fr.design.version.check.dialog=230*95
com.fr.design.version.detail.label=450*30
com.fr.design.version.detail.dialog=600*500
com.fr.env.SyncFailedPluginsDialog.messageWithLink=316*20
-com.fr.design.web.pane.text.field=450*20
\ No newline at end of file
+com.fr.design.web.pane.text.field=450*20
+com.fr.design.actions.server.dialog=700*630
+com.fr.design.report.fit.templatePane.dialog=600*400
+com.fr.design.report.fit.firstColumn=80*20
+com.fr.design.report.fit.column=100*20
\ No newline at end of file
diff --git a/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties b/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties
index 58e6ae1216..8a383a4387 100644
--- a/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties
+++ b/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties
@@ -7,4 +7,8 @@ com.fr.design.version.check.dialog=230*95
com.fr.design.version.detail.label=450*30
com.fr.design.version.detail.dialog=600*500
com.fr.env.SyncFailedPluginsDialog.messageWithLink=316*20
-com.fr.design.web.pane.text.field=450*20
\ No newline at end of file
+com.fr.design.web.pane.text.field=450*20
+com.fr.design.actions.server.dialog=700*630
+com.fr.design.report.fit.templatePane.dialog=600*400
+com.fr.design.report.fit.firstColumn=80*20
+com.fr.design.report.fit.column=100*20
\ No newline at end of file
diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java
index 1fdd6e9fd8..7260fe581c 100644
--- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java
+++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java
@@ -660,7 +660,7 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen
//记录改变前的plotID
String lastPlotID = editingCollection == null ? StringUtils.EMPTY : editingCollection.getSelectedChartProvider(ChartProvider.class).getID();
changeCollectionSelected(getButtonName());
- setSelectedWithFireListener(true);
+ setSelected(true, true);
fireSelectedChanged();
//需要先更新,最后重构面板
diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartAxisButtonPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartAxisButtonPane.java
index d5f866c818..3020093278 100644
--- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartAxisButtonPane.java
+++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartAxisButtonPane.java
@@ -356,7 +356,7 @@ public class VanChartAxisButtonPane extends BasicBeanPane {
if (isEnabled()) {
noSelected();
changeAxisSelected(getButtonName());
- setSelectedWithFireListener(true);
+ setSelected(true, true);
fireSelectedChanged();
}
}
diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java
index 84013aadfa..d17e9689e6 100644
--- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java
+++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java
@@ -68,7 +68,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
public FRFitLayoutAdapter(XLayoutContainer container) {
super(container);
initMinSize();
- this.frLayoutState = new FRNoFixLayoutAdapter(this, container, minHeight);
+ this.frLayoutState = new FRNoFixLayoutAdapter(this, container, minWidth, minHeight, actualVal);
painter = this.frLayoutState.getPainter();
}
@@ -151,13 +151,6 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
//如果当前处于边缘地带, 那么就把他贴到父容器上
boolean isMatchEdge = matchEdge(x, y);
- int componentHeight = comp.getHeight();
- int componentWidth = comp.getWidth();
- //上半部分高度
- int upHeight = (int) (componentHeight * TOP_HALF) + comp.getY();
- //下半部分高度
- int downHeight = (int) (componentHeight * BOTTOM_HALF) + comp.getY();
-
//布局控件要先判断是不是可编辑
XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer((XCreator) comp).getTopLayout();
boolean access = topLayout != null && !isMatchEdge && !topLayout.acceptType(XWAbsoluteLayout.class) && !isExtraContainer(comp) && !topLayout.isDragInAble();
@@ -167,17 +160,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
return false;
}
- if (isCrossPointArea(comp, x, y)) {
- return canAcceptWhileCrossPoint(comp, x, y);
- }
-
- if (isTrisectionArea(comp, x, y)) {
- return canAcceptWhileTrisection(comp, x, y);
- }
-
- boolean horizonValid = componentWidth >= minWidth * 2 + actualVal;
- boolean verticalValid = componentHeight >= minHeight * 2 + actualVal;
- return y > upHeight && y < downHeight ? horizonValid : verticalValid;
+ return this.frLayoutState.accept(creator, x, y);
}
private boolean isExtraContainer(Component comp) {
diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRNoFixLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRNoFixLayoutAdapter.java
index bdf67e00ea..aaeedfc8da 100644
--- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRNoFixLayoutAdapter.java
+++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRNoFixLayoutAdapter.java
@@ -12,13 +12,20 @@ import java.awt.Component;
import java.util.ArrayList;
public class FRNoFixLayoutAdapter extends AbstractLayoutAdapter {
- private int minHeight;
- private FRBodyLayoutAdapter parentLayoutAdapter;
+ private static final double TOP_HALF = 0.25;
+ private static final double BOTTOM_HALF = 0.75;
+ private final int minWidth;
+ private final int minHeight;
+ private final int actualVal;
+ private final FRBodyLayoutAdapter parentLayoutAdapter;
- public FRNoFixLayoutAdapter(FRBodyLayoutAdapter parentLayoutAdapter, XLayoutContainer container, int minHeight) {
+
+ public FRNoFixLayoutAdapter(FRBodyLayoutAdapter parentLayoutAdapter, XLayoutContainer container, int minWidth, int minHeight, int actualVal) {
super(container);
this.parentLayoutAdapter = parentLayoutAdapter;
+ this.minWidth = minWidth;
this.minHeight = minHeight;
+ this.actualVal = actualVal;
}
@Override
@@ -79,7 +86,7 @@ public class FRNoFixLayoutAdapter extends AbstractLayoutAdapter {
public void delete(XCreator creator, int creatorWidth, int creatorHeight) {
int x = creator.getX();
int y = creator.getY();
- ((FRFitLayoutAdapter)parentLayoutAdapter).recalculateChildrenSize(x, y, creatorWidth, creatorHeight, true);
+ ((FRFitLayoutAdapter) parentLayoutAdapter).recalculateChildrenSize(x, y, creatorWidth, creatorHeight, true);
}
@@ -100,7 +107,33 @@ public class FRNoFixLayoutAdapter extends AbstractLayoutAdapter {
@Override
public boolean accept(XCreator creator, int x, int y) {
- return true;
+ Component comp = container.getComponentAt(x, y);
+ if (comp == null || checkInterval(comp)) {
+ return false;
+ }
+ int componentHeight = comp.getHeight();
+ int componentWidth = comp.getWidth();
+ //上半部分高度
+ int upHeight = (int) (componentHeight * TOP_HALF) + comp.getY();
+ //下半部分高度
+ int downHeight = (int) (componentHeight * BOTTOM_HALF) + comp.getY();
+
+ if (parentLayoutAdapter.isCrossPointArea(comp, x, y)) {
+ return parentLayoutAdapter.canAcceptWhileCrossPoint(comp, x, y);
+ }
+
+ if (parentLayoutAdapter.isTrisectionArea(comp, x, y)) {
+ return parentLayoutAdapter.canAcceptWhileTrisection(comp, x, y);
+ }
+
+ boolean horizonValid = componentWidth >= minWidth * 2 + actualVal;
+ boolean verticalValid = componentHeight >= minHeight * 2 + actualVal;
+ return y > upHeight && y < downHeight ? horizonValid : verticalValid;
+ }
+
+ // 间隔区域
+ private boolean checkInterval(Component comp) {
+ return container.getComponentCount() > 0 && comp == container;
}
@Override
diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/painters/FRFixLayoutPainter.java b/designer-form/src/main/java/com/fr/design/designer/beans/painters/FRFixLayoutPainter.java
index f450a437a2..0f0aa2a6d2 100644
--- a/designer-form/src/main/java/com/fr/design/designer/beans/painters/FRFixLayoutPainter.java
+++ b/designer-form/src/main/java/com/fr/design/designer/beans/painters/FRFixLayoutPainter.java
@@ -1,6 +1,5 @@
package com.fr.design.designer.beans.painters;
-import com.fr.design.designer.beans.painters.AbstractPainter;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XOccupiedLayout;
@@ -36,8 +35,8 @@ public class FRFixLayoutPainter extends AbstractPainter {
@Override
public void paint(Graphics g, int startX, int startY) {
super.paint(g, startX, startY);
- int x = hotspot.x - hotspot_bounds.x;
- int y = hotspot.y - hotspot_bounds.y;
+ int x = hotspot.x - hotspot_bounds.x ;
+ int y = hotspot.y - hotspot_bounds.y ;
Component currentComp = container.getComponentAt(x, y);
if (currentComp == null) {
return;
@@ -50,7 +49,8 @@ public class FRFixLayoutPainter extends AbstractPainter {
} else if (!((XCreator) currentComp).acceptType(XOccupiedLayout.class)) {
state = OperateState.COMPONENT_REPLACE;
}
- state.paint(g, creator.getBackupRectangle(), currentComp.getBounds(), new Rectangle(x, y, creator.initEditorSize().width, ((XCreator) currentComp).initEditorSize().height));
+ Rectangle currentCompRec = new Rectangle(currentComp.getX() - startX, currentComp.getY() - startY, currentComp.getWidth(), currentComp.getHeight());
+ state.paint(g, creator.getBackupRectangle(), currentCompRec, new Rectangle(x, y, creator.initEditorSize().width, ((XCreator) currentComp).initEditorSize().height));
} else {
Color bColor = XCreatorConstants.LAYOUT_FORBIDDEN_COLOR;
int[] hot_rec = new int[]{x, y, 0, 0};
diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/painters/FROccupiedLayoutPainter.java b/designer-form/src/main/java/com/fr/design/designer/beans/painters/FROccupiedLayoutPainter.java
index 33a809a895..3a973b116f 100644
--- a/designer-form/src/main/java/com/fr/design/designer/beans/painters/FROccupiedLayoutPainter.java
+++ b/designer-form/src/main/java/com/fr/design/designer/beans/painters/FROccupiedLayoutPainter.java
@@ -40,11 +40,11 @@ public class FROccupiedLayoutPainter extends AbstractPainter {
Composite backupComposite = g2d.getComposite();
g2d.setColor(XCreatorConstants.DRAG_IN_OCCUPIED_LAYOUT_COLOR);
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.05f));
- g2d.fillRect(container.getX(), container.getY(), container.getWidth(), container.getHeight());
+ g2d.fillRect(container.getX() - startX, container.getY() - startY, container.getWidth(), container.getHeight());
g2d.setStroke(XCreatorConstants.DASH_STROKE);
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.2f));
- g2d.drawRect(container.getX() + 1, container.getY() + 1, container.getWidth() - 2, container.getHeight() - 2);
+ g2d.drawRect(container.getX() - startX + 1, container.getY() - startY + 1, container.getWidth() - 2, container.getHeight() - 2);
g2d.setStroke(backupStroke);
g2d.setComposite(backupComposite);
g2d.setColor(backupColor);
@@ -53,4 +53,4 @@ public class FROccupiedLayoutPainter extends AbstractPainter {
}
-}
\ No newline at end of file
+}
diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java
index 71aa6f9908..da4d235f07 100644
--- a/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java
+++ b/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java
@@ -886,6 +886,7 @@ public class XWFitLayout extends XLayoutContainer {
isRefreshing = true;
this.remove(oldCreator);
this.add(newCreator);
+ dealDirections(newCreator, false);
//对于新增的绝对布局的组件,需要更新下内部组件的大小
if (newCreator.acceptType(XWAbsoluteLayout.class)){
((XWAbsoluteLayout) newCreator).updateBoundsWidget();
diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java
index db5367ee9a..9284554dcb 100644
--- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java
+++ b/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java
@@ -25,7 +25,6 @@ import com.fr.stable.Constants;
import javax.swing.JComponent;
import javax.swing.SwingUtilities;
-import javax.swing.SwingWorker;
import javax.swing.plaf.ComponentUI;
import java.awt.AlphaComposite;
import java.awt.Color;
@@ -114,14 +113,8 @@ public class FormDesignerUI extends ComponentUI {
if (designer.getPainter() != null) {
// ComponentAdapter和LayoutAdapter提供的额外的Painter,该Painter一般用于提示作用,
// 相当于一个浮动层, 要考虑参数面板的高度
- new SwingWorker() {
- @Override
- protected Void doInBackground() throws Exception {
- designer.getPainter().paint(g, designer.getArea().getHorizontalValue(),
- designer.getArea().getVerticalValue() + designer.getParaHeight());
- return null;
- }
- }.execute();
+ designer.getPainter().paint(g, designer.getArea().getHorizontalValue(),
+ designer.getArea().getVerticalValue() + designer.getParaHeight());
}
AddingModel addingModel = designer.getAddingModel();
diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/DownloadSuitableThemeAction.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/DownloadSuitableThemeAction.java
index 8eb068fd68..399a644b40 100644
--- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/DownloadSuitableThemeAction.java
+++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/DownloadSuitableThemeAction.java
@@ -8,11 +8,14 @@ import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.UpdateAction;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.file.HistoryTemplateListCache;
+import com.fr.design.gui.imenu.UIMenuItem;
+import com.fr.design.gui.imenu.UIMenuItemUI;
import com.fr.design.i18n.Toolkit;
import com.fr.design.login.DesignerLoginHelper;
import com.fr.design.login.DesignerLoginSource;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
+import com.fr.design.mainframe.share.ui.constants.ColorConstants;
import com.fr.design.mainframe.share.util.DownloadUtils;
import com.fr.design.mainframe.theme.dialog.TemplateThemeUsingDialog;
import com.fr.stable.StringUtils;
@@ -22,6 +25,7 @@ import com.fr.workspace.WorkContext;
import javax.swing.Action;
import javax.swing.JOptionPane;
import javax.swing.SwingWorker;
+import java.awt.Color;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.WindowAdapter;
@@ -44,6 +48,15 @@ public class DownloadSuitableThemeAction extends UpdateAction {
this.setName(Toolkit.i18nText("Fine-Design_Share_Download_Suitable_Theme"));
}
+ @Override
+ public UIMenuItem createMenuItem() {
+ UIMenuItem menuItem = super.createMenuItem();
+ menuItem.setOpaque(true);
+ menuItem.setBackground(ColorConstants.BACKGROUND);
+ menuItem.setUI(new SharedComponentActionMenuItemUI());
+ return menuItem;
+ }
+
@Override
public void actionPerformed(ActionEvent e) {
currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/Jump2DetailAction.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/Jump2DetailAction.java
index 73a91fc871..698ec7545d 100644
--- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/Jump2DetailAction.java
+++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/Jump2DetailAction.java
@@ -1,11 +1,14 @@
package com.fr.design.mainframe.share.ui.actions;
import com.fr.design.actions.UpdateAction;
+import com.fr.design.gui.imenu.UIMenuItem;
+import com.fr.design.gui.imenu.UIMenuItemUI;
import com.fr.design.i18n.Toolkit;
-import com.fr.form.share.bean.OnlineShareWidget;
+import com.fr.design.mainframe.share.ui.constants.ColorConstants;
import com.fr.stable.StringUtils;
import javax.swing.Action;
+import java.awt.Color;
import java.awt.Desktop;
import java.awt.event.ActionEvent;
import java.io.IOException;
@@ -27,6 +30,15 @@ public class Jump2DetailAction extends UpdateAction {
this.setName(Toolkit.i18nText("Fine-Design_Share_Jump_To_Detail"));
}
+ @Override
+ public UIMenuItem createMenuItem() {
+ UIMenuItem menuItem = super.createMenuItem();
+ menuItem.setOpaque(true);
+ menuItem.setBackground(ColorConstants.BACKGROUND);
+ menuItem.setUI(new SharedComponentActionMenuItemUI());
+ return menuItem;
+ }
+
@Override
public void actionPerformed(ActionEvent e) {
if (StringUtils.isNotEmpty(id)) {
diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/SharedComponentActionMenuItemUI.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/SharedComponentActionMenuItemUI.java
new file mode 100644
index 0000000000..ca4d499b1d
--- /dev/null
+++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/SharedComponentActionMenuItemUI.java
@@ -0,0 +1,44 @@
+package com.fr.design.mainframe.share.ui.actions;
+
+import com.fr.design.constants.UIConstants;
+import com.fr.design.gui.imenu.UIMenuItemUI;
+import com.fr.design.utils.gui.GUIPaintUtils;
+import com.fr.stable.Constants;
+
+import javax.swing.ButtonModel;
+import javax.swing.JMenu;
+import javax.swing.JMenuItem;
+import javax.swing.JPopupMenu;
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+
+/**
+ * @author Starryi
+ * @version 1.0
+ * Created by Starryi on 2021/10/18
+ */
+public class SharedComponentActionMenuItemUI extends UIMenuItemUI {
+
+ @Override
+ protected void paintBackground(Graphics g, JMenuItem menuItem, Color bgColor) {
+ ButtonModel model = menuItem.getModel();
+ Color oldColor = g.getColor();
+ int menuWidth = menuItem.getWidth();
+ int menuHeight = menuItem.getHeight();
+
+ g.setColor(UIConstants.NORMAL_BACKGROUND);
+ g.fillRect(0, 0, menuWidth, menuHeight);
+ if (menuItem.isOpaque()) {
+ if (model.isArmed() || (menuItem instanceof JMenu && model.isSelected())) {
+ GUIPaintUtils.fillPaint((Graphics2D) g, 0, 0, menuWidth, menuHeight, true, Constants.NULL, UIConstants.FLESH_BLUE, 7);
+ } else {
+ GUIPaintUtils.fillPaint((Graphics2D) g, 0, 0, menuWidth, menuHeight, true, Constants.NULL, menuItem.getBackground(), 7);
+ }
+ g.setColor(oldColor);
+ } else if (model.isArmed() || (menuItem instanceof JMenu && model.isSelected())) {
+ GUIPaintUtils.fillPaint((Graphics2D) g, 0, 0, menuWidth, menuHeight, true, Constants.NULL, UIConstants.FLESH_BLUE, 7);
+ g.setColor(oldColor);
+ }
+ }
+}
diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java
index 54a813c43a..5ce5b57dd1 100644
--- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java
+++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java
@@ -1,10 +1,10 @@
package com.fr.design.mainframe.share.ui.block;
-import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.mainframe.share.ui.actions.DownloadSuitableThemeAction;
import com.fr.design.mainframe.share.ui.actions.Jump2DetailAction;
+import com.fr.design.mainframe.share.ui.constants.ColorConstants;
import com.fr.design.mainframe.share.ui.online.OnlineResourceManager;
import com.fr.design.mainframe.share.ui.online.OnlineWidgetSelectPane;
import com.fr.design.mainframe.share.ui.online.ResourceLoader;
@@ -116,7 +116,7 @@ public abstract class AbstractOnlineWidgetBlock extends PreviewWidgetBlock
UIPopupMenu popupMenu = new UIPopupMenu();
popupMenu.setOnlyText(true);
- popupMenu.setBackground(UIConstants.DEFAULT_BG_RULER);
- popupMenu.add(new PopupMenuItem(new MoveGroupAction()));
- popupMenu.add(new PopupMenuItem(new RemoveAction()));
+ popupMenu.setOpaque(true);
+ popupMenu.setBackground(ColorConstants.BACKGROUND);
+ popupMenu.add(new MoveGroupAction().createMenuItem());
+ popupMenu.add(new RemoveAction().createMenuItem());
return popupMenu;
}
@@ -288,6 +292,15 @@ public class LocalWidgetBlock extends PreviewWidgetBlock
this.setName(Toolkit.i18nText("Fine-Design_Share_Group_Move"));
}
+ @Override
+ public UIMenuItem createMenuItem() {
+ UIMenuItem menuItem = super.createMenuItem();
+ menuItem.setOpaque(true);
+ menuItem.setBackground(ColorConstants.BACKGROUND);
+ menuItem.setUI(new SharedComponentActionMenuItemUI());
+ return menuItem;
+ }
+
@Override
public void actionPerformed(ActionEvent e) {
new GroupMoveDialog(DesignerContext.getDesignerFrame()) {
@@ -314,6 +327,15 @@ public class LocalWidgetBlock extends PreviewWidgetBlock
this.setName(Toolkit.i18nText("Fine-Design_Share_Remove"));
}
+ @Override
+ public UIMenuItem createMenuItem() {
+ UIMenuItem menuItem = super.createMenuItem();
+ menuItem.setOpaque(true);
+ menuItem.setBackground(ColorConstants.BACKGROUND);
+ menuItem.setUI(new SharedComponentActionMenuItemUI());
+ return menuItem;
+ }
+
@Override
public void actionPerformed(ActionEvent e) {
int rv = FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(),
diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/constants/ColorConstants.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/constants/ColorConstants.java
new file mode 100644
index 0000000000..6bd815142f
--- /dev/null
+++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/constants/ColorConstants.java
@@ -0,0 +1,12 @@
+package com.fr.design.mainframe.share.ui.constants;
+
+import java.awt.Color;
+
+/**
+ * @author Starryi
+ * @version 1.0
+ * Created by Starryi on 2021/10/19
+ */
+public class ColorConstants {
+ public static final Color BACKGROUND = new Color(0xF0F0F1);
+}
diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetPopupPreviewPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetPopupPreviewPane.java
index 736377f06e..3113fd06ff 100644
--- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetPopupPreviewPane.java
+++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetPopupPreviewPane.java
@@ -5,6 +5,7 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.share.ui.base.AbstractWidgetPopupPreviewPane;
import com.fr.design.mainframe.share.ui.block.PreviewWidgetBlock;
+import com.fr.design.mainframe.share.ui.constants.ColorConstants;
import com.fr.form.share.bean.OnlineShareWidget;
import com.fr.general.FRFont;
import com.fr.general.IOUtils;
@@ -15,6 +16,7 @@ import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JSeparator;
import javax.swing.SwingConstants;
+import javax.swing.plaf.basic.BasicLabelUI;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
@@ -43,10 +45,13 @@ public class OnlineWidgetPopupPreviewPane extends AbstractWidgetPopupPreviewPane
private UILabel suitableThemeNameLabel;
public OnlineWidgetPopupPreviewPane() {
+ super();
setPreferredSize(new Dimension(POPUP_WIDTH, getPreferredSize().height));
setLayout(new BorderLayout(0, 0));
- setOpaque(true);
- setBackground(new Color(0xF0F0F1));
+ setBorder(BorderFactory.createLineBorder(new Color(0xDADADD)));
+ setBorderPainted(true);
+ setOpaque(false);
+ setBackground(ColorConstants.BACKGROUND);
suitableThemeNamePane = createSuitableThemeNamePane();
JPanel previewImagePane = createPreviewImagePane();
@@ -57,8 +62,9 @@ public class OnlineWidgetPopupPreviewPane extends AbstractWidgetPopupPreviewPane
private JPanel createSuitableThemeNamePane() {
suitableThemeNameLabel = new UILabel();
+ suitableThemeNameLabel.setUI(new BasicLabelUI());
suitableThemeNameLabel.setOpaque(false);
- suitableThemeNameLabel.setBackground(new Color(0xF5F5F7));
+ suitableThemeNameLabel.setBackground(null);
suitableThemeNameLabel.setIcon(IOUtils.readIcon("/com/fr/design/icon/icon_predefined_style.png"));
suitableThemeNameLabel.setIconTextGap(IntervalConstants.INTERVAL_L6);
@@ -92,10 +98,12 @@ public class OnlineWidgetPopupPreviewPane extends AbstractWidgetPopupPreviewPane
versionLabel = new UILabel();
versionLabel.setVerticalAlignment(SwingConstants.CENTER);
versionLabel.setFont(FRFont.getInstance(versionLabel.getFont()).deriveFont(12.0F));
+ versionLabel.setForeground(new Color(0x333334));
downloadsLabel = new UILabel();
downloadsLabel.setVerticalAlignment(SwingConstants.TOP);
downloadsLabel.setFont(FRFont.getInstance(downloadsLabel.getFont()).deriveFont(12.0F));
+ downloadsLabel.setForeground(new Color(0x333334));
priceLabel = new UILabel();
priceLabel.setVerticalAlignment(SwingConstants.CENTER);
@@ -162,7 +170,7 @@ public class OnlineWidgetPopupPreviewPane extends AbstractWidgetPopupPreviewPane
String themeName = widget.getThemeName();
if (StringUtils.isNotEmpty(themeName)) {
suitableThemeNamePane.setVisible(true);
- suitableThemeNameLabel.setText(themeName);
+ suitableThemeNameLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Share_Suitable_Theme_Prefix") + themeName);
} else {
suitableThemeNamePane.setVisible(false);
}
diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPane.java
index 4e8f9ffc5f..7623c2e0aa 100644
--- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPane.java
+++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPane.java
@@ -151,7 +151,7 @@ public class FilterPane extends JPanel {
Point p = FilterPane.this.getLocationOnScreen();
popup = pf.getPopup(FilterPane.this, filterPopupPane, p.x, p.y + FilterPane.this.getHeight());
popup.show();
- filterPopupPane.setPreferredSize(new Dimension(228, filterPopupPane.getHeight()));
+ filterPopupPane.setPreferredSize(new Dimension(filterPopupPane.getWidth(), filterPopupPane.getHeight()));
showPopup = true;
arrowButton.setIcon(FILTER_COMBO_UP);
firePopupStateChange(true);
diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPopupPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPopupPane.java
index e2bcd5344d..f0d3714c7d 100644
--- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPopupPane.java
+++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPopupPane.java
@@ -31,6 +31,8 @@ public abstract class FilterPopupPane extends JPanel {
private static final Color BORDER_COLOR = Color.decode("#D9DADD");
private static final String FILTER_ALL_ID = "0";
+ public static final int CONTENT_WIDTH = 225;
+
FilterPane filterPane;
private List filterList = new ArrayList<>();
private final List checkBoxList = new ArrayList<>();
@@ -101,7 +103,7 @@ public abstract class FilterPopupPane extends JPanel {
jPanel.setBackground(Color.WHITE);
UILabel titleLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Type"));
titleLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
- titleLabel.setPreferredSize(new Dimension(226, 20));
+ titleLabel.setPreferredSize(new Dimension(CONTENT_WIDTH - 2, 20));
titleLabel.setOpaque(true);
titleLabel.setBackground(Color.decode("#EDEDEE"));
jPanel.add(titleLabel, BorderLayout.NORTH);
@@ -131,7 +133,7 @@ public abstract class FilterPopupPane extends JPanel {
jPanel.setBackground(Color.WHITE);
UILabel titleLabel = new UILabel(filterTypeInfo.getTitle());
titleLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
- titleLabel.setPreferredSize(new Dimension(226, 20));
+ titleLabel.setPreferredSize(new Dimension(CONTENT_WIDTH - 2, 20));
titleLabel.setOpaque(true);
titleLabel.setBackground(Color.decode("#EDEDEE"));
jPanel.add(titleLabel, BorderLayout.NORTH);
@@ -150,7 +152,7 @@ public abstract class FilterPopupPane extends JPanel {
}
}
int contentPaneHeight = ((displayCount + 1) / 2) * 27;
- contentPane.setPreferredSize(new Dimension(228, contentPaneHeight));
+ contentPane.setPreferredSize(new Dimension(CONTENT_WIDTH, contentPaneHeight));
for (final WidgetFilterInfo filterInfo : filterTypeInfo.getFilterItems()) {
if (ComparatorUtils.equals(FILTER_ALL_ID, filterInfo.getId())) {
continue;
diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/NewFormPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/NewFormPane.java
index dfa156d5e1..ca3e266543 100644
--- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/NewFormPane.java
+++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/NewFormPane.java
@@ -1,6 +1,7 @@
package com.fr.design.widget.ui.designer;
import com.fr.base.iofile.attr.TemplateLayoutIdAttrMark;
+import com.fr.design.DesignerEnvManager;
import com.fr.design.border.UITitledMatteBorder;
import com.fr.design.designer.beans.PredefinedLayout;
import com.fr.design.designer.beans.models.NewFormModel;
@@ -187,17 +188,14 @@ public class NewFormPane extends BasicPane {
Toolkit.i18nText("Fine-Design_Real_Style_Template")
});
buttonGroup.setPreferredSize(new Dimension(140, 20));
- buttonGroup.setSelectedIndex(1);
+ buttonGroup.setSelectedIndex(DesignerEnvManager.getEnvManager().getLayoutTemplateStyle());
buttonGroup.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
int selectedIndex = buttonGroup.getSelectedIndex();
for (PredefinedLayoutPane layoutCard : layoutCards) {
- if (selectedIndex == 1) {
- layoutCard.showRealStyle();
- } else {
- layoutCard.showSimpleStyle();
- }
+ DesignerEnvManager.getEnvManager().setLayoutTemplateStyle(selectedIndex);
+ layoutCard.showCard();
}
}
});
diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/PredefinedLayoutPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/PredefinedLayoutPane.java
index bde9b07eed..097440f961 100644
--- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/PredefinedLayoutPane.java
+++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/PredefinedLayoutPane.java
@@ -2,6 +2,7 @@ package com.fr.design.widget.ui.designer;
import com.fr.base.GraphHelper;
import com.fr.base.svg.IconUtils;
+import com.fr.design.DesignerEnvManager;
import com.fr.design.designer.beans.PredefinedLayout;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.share.ui.base.MouseClickListener;
@@ -40,6 +41,7 @@ public class PredefinedLayoutPane extends JPanel {
this.add(simpleStyle, 1);
this.setPreferredSize(new Dimension(235, 134));
this.initListener();
+ this.showCard();
}
protected void initListener() {
@@ -84,6 +86,14 @@ public class PredefinedLayoutPane extends JPanel {
this.clickListener = clickListener;
}
+ public void showCard() {
+ if (DesignerEnvManager.getEnvManager().getLayoutTemplateStyle() == DesignerEnvManager.LAYOUT_TEMPLATE_SIMPLE_STYLE) {
+ showSimpleStyle();
+ } else if (DesignerEnvManager.getEnvManager().getLayoutTemplateStyle() == DesignerEnvManager.LAYOUT_TEMPLATE_REAL_STYLE) {
+ showRealStyle();
+ }
+ }
+
public void showSimpleStyle() {
cardLayout.last(this);
}
diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/ElementEditorDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/ElementEditorDefinePane.java
index e32bc9b071..9507248df3 100644
--- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/ElementEditorDefinePane.java
+++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/ElementEditorDefinePane.java
@@ -102,8 +102,10 @@ public class ElementEditorDefinePane extends WTitleLayoutDefinePane {
return tabPane.getSelectedIndex() == ONE_INDEX;
}
- /**
- * @param ePane
- */
- public void dealWithBorder(ElementCasePane ePane) {
- this.reportPane = ePane;
+ public void dealWithBorder() {
+ if (reportPane == null) {
+ return;
+ }
Object[] fourObjectArray = BorderUtils.createCellBorderObject(reportPane);
if (fourObjectArray != null && fourObjectArray.length % LENGTH_FOUR == 0) {
@@ -130,7 +129,14 @@ public class CustomStylePane extends MultiTabPane