Browse Source

Merge branch 'release/11.0' of https://code.fineres.com/scm/~henry.wang/design into release/11.0

bugfix/11.0
Henry.Wang 3 years ago
parent
commit
48ec032872
  1. 10
      designer-base/src/main/java/com/fr/design/base/mode/DesignModeContext.java
  2. 20
      designer-base/src/main/java/com/fr/design/base/mode/DesignerMode.java
  3. 7
      designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java
  4. 3
      designer-base/src/main/java/com/fr/design/gui/ifilechooser/JavaFxNativeFileChooser.java
  5. 11
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  6. 7
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java
  7. 41
      designer-base/src/main/java/com/fr/design/mainframe/theme/utils/DefaultThemedFloatElement.java
  8. 35
      designer-base/src/main/java/com/fr/design/roleAuthority/RolesEditedSourceOP.java
  9. 5
      designer-base/src/main/java/com/fr/design/style/color/ColorSelectDialog.java
  10. 9
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisScrollPaneWithTypeSelect.java
  11. 2
      designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java
  12. 36
      designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java
  13. 36
      designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java
  14. 33
      designer-form/src/main/java/com/fr/design/mainframe/FormSpacingLineDrawer.java
  15. 10
      designer-form/src/main/java/com/fr/design/mainframe/share/generate/task/ComponentCreator.java
  16. 3
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetBlock.java
  17. 9
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/OnlineWidgetBlock.java
  18. 16
      designer-form/src/main/java/com/fr/design/mainframe/share/util/ShareComponentUtils.java
  19. 3
      designer-realize/src/main/java/com/fr/design/actions/insert/flot/ChartFloatAction.java
  20. 3
      designer-realize/src/main/java/com/fr/design/actions/insert/flot/FormulaFloatAction.java
  21. 3
      designer-realize/src/main/java/com/fr/design/actions/insert/flot/ImageFloatAction.java
  22. 3
      designer-realize/src/main/java/com/fr/design/actions/insert/flot/TextBoxFloatAction.java
  23. 5
      designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java

10
designer-base/src/main/java/com/fr/design/base/mode/DesignModeContext.java

@ -10,7 +10,15 @@ public class DesignModeContext {
private static DesignerMode mode = DesignerMode.NORMAL;
public static void switchTo(DesignerMode mode) {
DesignModeContext.mode = mode;
changeMode(DesignModeContext.mode, mode);
}
private static void changeMode(DesignerMode oldMode, DesignerMode newMode) {
if (oldMode != newMode) {
DesignModeContext.mode = newMode;
oldMode.closeMode();
newMode.openMode();
}
}
public static DesignerMode getMode() {

20
designer-base/src/main/java/com/fr/design/base/mode/DesignerMode.java

@ -1,9 +1,25 @@
package com.fr.design.base.mode;
import com.fr.design.mainframe.DesignerContext;
public enum DesignerMode {
NORMAL,
BAN_COPY_AND_CUT,
VCS,
AUTHORITY,
DUCHAMP
AUTHORITY {
@Override
public void closeMode() {
DesignerContext.getDesignerFrame().closeAuthorityMode();
}
},
DUCHAMP;
public void openMode() {
}
public void closeMode() {
}
}

7
designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java

@ -4,6 +4,7 @@ import com.fr.base.chart.chartdata.CallbackEvent;
import com.fr.base.io.BaseBook;
import com.fr.design.DesignerEnvManager;
import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.base.mode.DesignerMode;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.file.filter.ClassFilter;
import com.fr.design.i18n.Toolkit;
@ -69,7 +70,7 @@ public class HistoryTemplateListCache implements CallbackEvent {
DesignTableDataManager.closeTemplate(selected);
//直接关闭模板的时候(当且仅当设计器tab上只剩一个模板)退出权限编辑
if (DesignModeContext.isAuthorityEditing() && historyList.size() <= 1) {
DesignerContext.getDesignerFrame().closeAuthorityEditing();
DesignModeContext.switchTo(DesignerMode.NORMAL);
}
if (contains(selected) == -1) {
return;
@ -430,13 +431,13 @@ public class HistoryTemplateListCache implements CallbackEvent {
*/
@Deprecated
public void reloadCurrentTemplate() {
reloadAllEditingTemplate();
reloadAllEditingTemplate();
}
/**
* 重绘当前模板
*/
public void repaintCurrentEditingTemplate(){
public void repaintCurrentEditingTemplate() {
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {

3
designer-base/src/main/java/com/fr/design/gui/ifilechooser/JavaFxNativeFileChooser.java

@ -67,6 +67,9 @@ public class JavaFxNativeFileChooser implements FileChooserProvider {
fileChooserParent = DesignerContext.getDesignerFrame();
}
Stage stage = showCoverStage(fileChooserParent);
if (stage != null) {
stage.setAlwaysOnTop(true);
}
try {
if (fileSelectionMode == FileSelectionMode.FILE || fileSelectionMode == FileSelectionMode.MULTIPLE_FILE) {
FileChooser fileChooser = new FileChooser();

11
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java

@ -9,6 +9,7 @@ import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.base.mode.DesignerMode;
import com.fr.design.constants.UIConstants;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.TableDataTreePane;
@ -221,7 +222,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
@Override
public void mouseReleased(MouseEvent e) {
if (DesignModeContext.isAuthorityEditing()) {
closeAuthorityEditing();
DesignModeContext.switchTo(DesignerMode.NORMAL);
}
}
@ -301,8 +302,12 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().doResize();
}
@Deprecated
public void closeAuthorityEditing() {
DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.NORMAL);
DesignModeContext.switchTo(DesignerMode.NORMAL);
}
public void closeAuthorityMode() {
WestRegionContainerPane.getInstance().replaceDownPane(
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()));
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane();
@ -314,6 +319,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
EventDispatcher.fire(DesignAuthorityEventType.StopEdit, DesignerFrame.this);
}
/**
* 注册app.
*
@ -793,6 +799,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* @param jt 添加的模板.
*/
public void addAndActivateJTemplate(JTemplate<?, ?> jt) {
DesignModeContext.switchTo(DesignerMode.NORMAL);
JTemplate currentEditingTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (currentEditingTemplate != null) {
currentEditingTemplate.stopEditing();

7
designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java

@ -1,11 +1,11 @@
package com.fr.design.mainframe.theme;
import com.fr.base.theme.FineColorFlushUtils;
import com.fr.base.theme.FineColorManager;
import com.fr.base.theme.TemplateTheme;
import com.fr.base.theme.TemplateThemeConfig;
import com.fr.base.theme.settings.ThemeThumbnail;
import com.fr.base.theme.settings.ThemedCellStyleList;
import com.fr.base.theme.settings.ThemedChartStyle;
import com.fr.base.theme.settings.ThemedColorScheme;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.dialog.FineJOptionPane;
@ -31,9 +31,6 @@ import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import com.fr.transaction.CallBackAdaptor;
import com.fr.transaction.Configurations;
import com.fr.transaction.WorkerFacade;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JDialog;
@ -317,12 +314,14 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
FineColorManager.FineColorReplaceByColorScheme replaceByColorScheme = new FineColorManager.FineColorReplaceByColorScheme(colors);
T theme = updateBean();
FineColorFlushUtils.replaceCacheObject(theme, replaceByColorScheme);
FineColorManager.traverse(theme, replaceByColorScheme);
populateBean4CustomEditors(theme);
//图表渐变色
chartStyleSettingPane.populateGradientBar(colors);
themePreviewPane.refresh(theme);
this.repaint();
}
public void populateBean(T theme) {

41
designer-base/src/main/java/com/fr/design/mainframe/theme/utils/DefaultThemedFloatElement.java

@ -0,0 +1,41 @@
package com.fr.design.mainframe.theme.utils;
import com.fr.base.NameStyle;
import com.fr.base.theme.TemplateTheme;
import com.fr.base.theme.settings.ThemedCellStyle;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.mainframe.JTemplate;
import com.fr.report.cell.FloatElement;
import com.fr.stable.unit.UNIT;
/**
* @author Starryi
* @version 1.0
* Created by Starryi on 2021/9/9
*/
public class DefaultThemedFloatElement {
public static FloatElement createInstance() {
return themingFloatElement(new FloatElement());
}
public static FloatElement createInstance(Object value) {
return themingFloatElement(new FloatElement(value));
}
public static FloatElement createInstance(UNIT leftDistance, UNIT topDistance, UNIT width, UNIT height, Object value) {
return themingFloatElement(new FloatElement(leftDistance, topDistance, width, height, value));
}
private static FloatElement themingFloatElement(FloatElement floatElement) {
JTemplate<?,?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (template != null) {
TemplateTheme theme = template.getTemplateTheme();
ThemedCellStyle themedCellStyle = theme.getCellStyleList().getUse4Default();
if (themedCellStyle != null) {
NameStyle nameStyle = NameStyle.getPassiveInstance(themedCellStyle.getName(), themedCellStyle.getStyle());
floatElement.setStyle(nameStyle);
}
}
return floatElement;
}
}

35
designer-base/src/main/java/com/fr/design/roleAuthority/RolesEditedSourceOP.java

@ -18,21 +18,22 @@ import java.util.Map;
*/
public class RolesEditedSourceOP extends RoleSourceOP {
protected ExpandMutableTreeNode[] getNodeArrayFromMap(Map<String, RoleDataWrapper> map) {
List<ExpandMutableTreeNode> roleList = new ArrayList<ExpandMutableTreeNode>();
Iterator<Map.Entry<String, RoleDataWrapper>> entryIt = map.entrySet().iterator();
while (entryIt.hasNext()) {
Map.Entry<String, RoleDataWrapper> entry = entryIt.next();
RoleDataWrapper t = entry.getValue();
JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
PrivilegeEditedRoleProvider pe = (PrivilegeEditedRoleProvider) jt.getTarget();
ExpandMutableTreeNode[] expand = t.load(Arrays.asList(pe.getAllEditedRoleSet()));
for (ExpandMutableTreeNode expandMutableTreeNode : expand) {
roleList.add(expandMutableTreeNode);
}
}
return roleList.toArray(new ExpandMutableTreeNode[roleList.size()]);
}
protected ExpandMutableTreeNode[] getNodeArrayFromMap(Map<String, RoleDataWrapper> map) {
List<ExpandMutableTreeNode> roleList = new ArrayList<ExpandMutableTreeNode>();
Iterator<Map.Entry<String, RoleDataWrapper>> entryIt = map.entrySet().iterator();
while (entryIt.hasNext()) {
Map.Entry<String, RoleDataWrapper> entry = entryIt.next();
RoleDataWrapper t = entry.getValue();
JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (jt.getTarget() instanceof PrivilegeEditedRoleProvider) {
PrivilegeEditedRoleProvider pe = (PrivilegeEditedRoleProvider) jt.getTarget();
ExpandMutableTreeNode[] expand = t.load(Arrays.asList(pe.getAllEditedRoleSet()));
for (ExpandMutableTreeNode expandMutableTreeNode : expand) {
roleList.add(expandMutableTreeNode);
}
}
}
return roleList.toArray(new ExpandMutableTreeNode[roleList.size()]);
}
}

5
designer-base/src/main/java/com/fr/design/style/color/ColorSelectDialog.java

@ -1,6 +1,7 @@
package com.fr.design.style.color;
import com.fr.base.chart.BaseChartCollection;
import com.fr.design.DesignerEnvManager;
import com.fr.design.gui.chart.MiddleChartDialog;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.utils.gui.GUICoreUtils;
@ -101,7 +102,9 @@ public class ColorSelectDialog extends MiddleChartDialog{
ok.setActionCommand("OK");
ok.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
seletePane.setColor(okListener.getColor());
Color color = okListener.getColor();
seletePane.setColor(color);
DesignerEnvManager.getEnvManager().getColorConfigManager().addToColorQueue(color);
doOK();
}
});

9
designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisScrollPaneWithTypeSelect.java

@ -1,9 +1,10 @@
package com.fr.van.chart.designer.style.axis;
import com.fr.chart.base.ColorWithThemeStyle;
import com.fr.chart.chartattr.Axis;
import com.fr.design.i18n.Toolkit;
import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.gui.frpane.UIComboBoxPane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.attr.axis.VanChartAxis;
@ -16,9 +17,9 @@ import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.util.ArrayList;
import java.util.List;
import java.awt.BorderLayout;
/**
* 带有坐标轴类型选择控件可选类型分类时间数值
@ -98,11 +99,13 @@ public class VanChartAxisScrollPaneWithTypeSelect extends AbstractVanChartScroll
public VanChartAxis update(VanChartAxis axis) {
int index = axisTypePane.getSelectedIndex();
ColorWithThemeStyle mainGridColorWithPreStyle = axis.getMainGridColorWithPreStyle();
if(ComparatorUtils.equals(index, AxisType.AXIS_CATEGORY.ordinal())){
if(ComparatorUtils.equals(axis.getAxisType(), AxisType.AXIS_CATEGORY)){
textAxisPane.updateBean(axis);
} else {
axis = new VanChartAxis(axis.getAxisName(), axis.getPosition(), axis.getGridLineType(), axis.getMainGridColor());
axis.setMainGridColorWithPreStyle(mainGridColorWithPreStyle);
textAxisPane.updateBean(axis);
}
} else if(ComparatorUtils.equals(index, AxisType.AXIS_TIME.ordinal())){
@ -110,6 +113,7 @@ public class VanChartAxisScrollPaneWithTypeSelect extends AbstractVanChartScroll
timeAxisPane.updateBean(axis);
} else {
axis = new VanChartTimeAxis(axis.getAxisName(), axis.getPosition(), axis.getGridLineType(), axis.getMainGridColor());
axis.setMainGridColorWithPreStyle(mainGridColorWithPreStyle);
timeAxisPane.updateBean(axis);
}
} else if(ComparatorUtils.equals(index, AxisType.AXIS_VALUE.ordinal())){
@ -117,6 +121,7 @@ public class VanChartAxisScrollPaneWithTypeSelect extends AbstractVanChartScroll
valueAxisPane.updateBean(axis);
} else {
axis = new VanChartValueAxis(axis.getAxisName(), axis.getPosition(), axis.getGridLineType(), axis.getMainGridColor());
axis.setMainGridColorWithPreStyle(mainGridColorWithPreStyle);
valueAxisPane.updateBean(axis);
}
}

2
designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java

@ -787,7 +787,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
int formDesignerWidth = designer.getWidth();
int formDesignerHeight = designer.getHeight();
// 不超过可绘制区域
int extraX = Math.min(creatorRightX, formDesignerWidth);
int extraX = creatorRightX < 0 ? 0 : Math.min(creatorRightX, formDesignerWidth);
int extraY = creatorRightY < 0 ? 0 : Math.min(creatorRightY, formDesignerHeight);
if (designer.isFormParaDesigner() && extraY + this.getHeight() >= formDesignerHeight) {

36
designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java

@ -3,6 +3,11 @@
*/
package com.fr.design.designer.creator;
import com.fr.base.theme.FineColorManager;
import com.fr.base.theme.FormTheme;
import com.fr.base.theme.TemplateTheme;
import com.fr.base.theme.TemplateThemeAware;
import com.fr.base.theme.TemplateThemeCompatible;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.designer.creator.cardlayout.XCardAddButton;
import com.fr.design.designer.creator.cardlayout.XCardSwitchButton;
@ -11,11 +16,15 @@ import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout;
import com.fr.design.designer.creator.cardlayout.XWCardTagLayout;
import com.fr.design.designer.creator.cardlayout.XWCardTitleLayout;
import com.fr.design.designer.creator.cardlayout.XWTabFitLayout;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.fun.ChartWidgetOptionProvider;
import com.fr.design.fun.FormWidgetOptionProvider;
import com.fr.design.fun.ParameterWidgetOptionProvider;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.module.DesignModuleFactory;
import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.main.Form;
import com.fr.form.main.WidgetGather;
import com.fr.form.parameter.FormSubmitButton;
import com.fr.form.ui.Button;
import com.fr.form.ui.CardAddButton;
@ -216,6 +225,16 @@ public class XCreatorUtils {
return xClazz;
}
public static XCreator createThemedXCreator(Widget widget) {
XCreator creator = createXCreator(widget);
JTemplate<?,?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
TemplateTheme theme = template.getTemplateTheme();
if (theme instanceof FormTheme) {
setupTemplateTheme(creator, (FormTheme) theme, TemplateThemeCompatible.NONE);
}
return creator;
}
/**
* 创建creator
*
@ -356,4 +375,21 @@ public class XCreatorUtils {
}
return null;
}
public static void setupTemplateTheme(XCreator container, final FormTheme currentTemplateUsingTheme, TemplateThemeCompatible compatible) {
FineColorManager.traverse(container.toData(), new FineColorManager.FineColorReplaceByTheme(currentTemplateUsingTheme, compatible));
Form.traversalWidget(container.toData(), new WidgetGather() {
@Override
public void dealWith(Widget widget) {
TemplateThemeAware<FormTheme> themedWidget = (TemplateThemeAware) widget;
themedWidget.onTemplateUsingThemeChange(currentTemplateUsingTheme, compatible);
}
@Override
public boolean dealWithAllCards() {
return true;
}
}, TemplateThemeAware.class);
}
}

36
designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java

@ -1195,9 +1195,6 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
* @param xCreator 组件
*/
public void startDraggingBean(XCreator xCreator) {
// 新疆的图表块和报表块默认主题化
addThemeToDroppedNewWidget(xCreator);
// 根据所选择的组件的BeanInfo生成相应的AddingModel
// AddingModel和StateModel不一样,适合当前选择的组件相关的
addingModel = new AddingModel(this, xCreator);
@ -1862,37 +1859,4 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
public FormSpacingLineDrawer getSpacingLineDrawer() {
return spacingLineDrawer;
}
private void addThemeToDroppedNewWidget(XCreator addingXCreator) {
JTemplate<?,?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (template == null) {
return;
}
TemplateTheme theme = template.getTemplateTheme();
if (!(theme instanceof FormTheme)) {
return;
}
FormTheme formTheme = (FormTheme) theme;
Form.traversalWidget(addingXCreator.toData(), new WidgetGather() {
@Override
public void dealWith(Widget widget) {
if (widget instanceof AbstractBorderStyleWidget) {
AbstractBorderStyleWidget styleWidget = (AbstractBorderStyleWidget) widget;
if (!styleWidget.supportThemed()) {
return;
}
boolean followingTheme = (!addingXCreator.isShared()) || styleWidget.isBorderStyleFollowingTheme();
styleWidget.setBorderStyleFollowingTheme(followingTheme);
if (followingTheme) {
styleWidget.onTemplateUsingThemeChange(formTheme, TemplateThemeCompatible.NONE);
}
}
}
@Override
public boolean dealWithAllCards() { return true; }
}, AbstractBorderStyleWidget.class);
addingXCreator.rebuid();
}
}

33
designer-form/src/main/java/com/fr/design/mainframe/FormSpacingLineDrawer.java

@ -137,43 +137,22 @@ public class FormSpacingLineDrawer {
GraphDrawHelper.drawString(g2d, text, labelX, labelY);
}
private boolean isSelectedParaComponent() {
return designer.getParaComponent() == selectedCreator;
}
private boolean isSelectedRootComponent() {
return designer.isRoot(selectedCreator);
}
private boolean isSelectedForm() {
return selectedCreator.getParent() == null;
}
private boolean isNeedExtendedLine(AbstractFormParallelLine[] nearestSides) {
return nearestSides[0].isVerticalCenterLineBeforeTheParallelLine(nearestSides[1]) || nearestSides[0].isVerticalCenterLineBehindTheParallelLine(nearestSides[1]);
}
private boolean isSelectedRootPane() {
// form、body、para这三个选中了,都不要画任何间距线
return isSelectedForm() || isSelectedRootComponent() || isSelectedParaComponent();
}
// 当前组件是否在参数面板里面
private boolean isCompInBody(XCreator creator) {
private boolean isComponentInBody(XCreator creator) {
XLayoutContainer container = XCreatorUtils.getHotspotContainer(creator);
return container != null && !container.acceptType(XWParameterLayout.class);
}
private boolean isSelectedCompInBody() {
return isCompInBody(selectedCreator);
}
private boolean isHoveredCompInBody() {
return isCompInBody(hoverCreator);
private boolean isSelectedComponentInBody() {
return isComponentInBody(selectedCreator);
}
private boolean isCompInBody() {
return isSelectedCompInBody() && isHoveredCompInBody();
private boolean isHoveredComponentInBody() {
return isComponentInBody(hoverCreator);
}
private boolean isBodyAbsoluteLayout() {
@ -185,7 +164,7 @@ public class FormSpacingLineDrawer {
}
private boolean isDrawSpacingLine() {
return isInAbsoluteLayout() && !isSelectedRootPane() && isCompInBody();
return isInAbsoluteLayout() && isSelectedComponentInBody() && isHoveredComponentInBody();
}
private AbstractFormParallelLine[] getNearestHorizontalSide() {

10
designer-form/src/main/java/com/fr/design/mainframe/share/generate/task/ComponentCreator.java

@ -3,6 +3,7 @@ package com.fr.design.mainframe.share.generate.task;
import com.fr.base.TableData;
import com.fr.base.iofile.attr.ExtendSharableAttrMark;
import com.fr.base.iofile.attr.SharableAttrMark;
import com.fr.base.theme.TemplateTheme;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.share.generate.impl.AbstractComponentCreatorProcessor;
@ -39,6 +40,8 @@ public class ComponentCreator extends AbstractComponentCreatorProcessor {
@Override
public ComponentReuBean create(JTemplate<?, ?> jt, Map<String, Object> paraMap, Widget widget, DefaultSharableWidget info) throws Exception {
// 适用于共享组件的模版主题
setSuitableTemplateThemeName(jt, info);
// 遍历判断是否存在共享组件
checkOriginStatus(widget, info);
@ -56,6 +59,13 @@ public class ComponentCreator extends AbstractComponentCreatorProcessor {
return new ComponentReuBean(generatePath, editor, info);
}
private void setSuitableTemplateThemeName(JTemplate<?, ?> jt, DefaultSharableWidget info) {
TemplateTheme theme = jt.getTemplateTheme();
if (theme != null) {
info.setSuitableTemplateThemeName(theme.getName());
}
}
protected void checkOriginStatus(Widget widget, final DefaultSharableWidget info) {
Form.traversalWidget(widget, new WidgetGatherAdapter() {

3
designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetBlock.java

@ -211,7 +211,8 @@ public class LocalWidgetBlock extends PreviewWidgetBlock<DefaultSharableWidget>
creatorSource.setWidgetID(UUID.randomUUID().toString());
((AbstractBorderStyleWidget) creatorSource).addWidgetAttrMark(new SharableAttrMark(true));
//tab布局WCardMainBorderLayout通过反射出来的大小是960*480
XCreator xCreator = ShareComponentUtils.createXCreator(creatorSource, shareId, no.getBindInfo());
String suitableTemplateThemeName = no.getWidget().getSuitableTemplateThemeName();
XCreator xCreator = ShareComponentUtils.createThemedXCreator(creatorSource, suitableTemplateThemeName, shareId, no.getBindInfo());
WidgetToolBarPane.getTarget().startDraggingBean(xCreator);
lastPressEvent = null;
this.setBorder(null);

9
designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/OnlineWidgetBlock.java

@ -12,6 +12,7 @@ import com.fr.design.login.DesignerLoginHelper;
import com.fr.design.login.DesignerLoginSource;
import com.fr.design.mainframe.WidgetToolBarPane;
import com.fr.design.mainframe.share.collect.ComponentCollector;
import com.fr.form.share.DefaultSharableWidget;
import com.fr.form.share.group.DefaultShareGroup;
import com.fr.design.mainframe.share.ui.local.LocalWidgetRepoPane;
import com.fr.design.mainframe.share.ui.online.OnlineWidgetRepoPane;
@ -143,7 +144,13 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock {
((AbstractBorderStyleWidget) creatorSource).addWidgetAttrMark(new SharableAttrMark(true));
SharableWidgetProvider bindInfo = ShareUtils.getElCaseBindInfoById(shareId);
//tab布局WCardMainBorderLayout通过反射出来的大小是960*480
XCreator xCreator = ShareComponentUtils.createXCreator(creatorSource, shareId, bindInfo);
XCreator xCreator;
if (bindInfo instanceof DefaultSharableWidget) {
String suitableTemplateThemeName = ((DefaultSharableWidget) bindInfo).getSuitableTemplateThemeName();
xCreator = ShareComponentUtils.createThemedXCreator(creatorSource, suitableTemplateThemeName, shareId, bindInfo);
} else {
xCreator = ShareComponentUtils.createXCreator(creatorSource, shareId, bindInfo);
}
WidgetToolBarPane.getTarget().startDraggingBean(xCreator);
lastPressEvent = null;
this.setBorder(null);

16
designer-form/src/main/java/com/fr/design/mainframe/share/util/ShareComponentUtils.java

@ -2,6 +2,9 @@ package com.fr.design.mainframe.share.util;
import com.fr.base.io.IOFile;
import com.fr.base.iofile.attr.ExtendSharableAttrMark;
import com.fr.base.theme.FormTheme;
import com.fr.base.theme.TemplateTheme;
import com.fr.base.theme.TemplateThemeCompatible;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.designer.creator.XLayoutContainer;
@ -50,6 +53,19 @@ public class ShareComponentUtils {
return xCreator;
}
public static XCreator createThemedXCreator(Widget creatorSource, String suitableTemplateThemeName, String shareId, SharableWidgetProvider provider) {
XCreator creator = createXCreator(creatorSource, shareId, provider);
JTemplate<?,?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
TemplateTheme theme = template.getTemplateTheme();
if (theme instanceof FormTheme) {
boolean isCurrentUsingThemeSuitSharedComponent = StringUtils.isNotEmpty(theme.getName()) &&
StringUtils.isNotEmpty(suitableTemplateThemeName) &&
StringUtils.equals(theme.getName(), suitableTemplateThemeName);
XCreatorUtils.setupTemplateTheme(creator, (FormTheme) theme, isCurrentUsingThemeSuitSharedComponent ? TemplateThemeCompatible.NONE : TemplateThemeCompatible.ABSENT);
}
return creator;
}
/**
* 检查readme.txt文件
*/

3
designer-realize/src/main/java/com/fr/design/actions/insert/flot/ChartFloatAction.java

@ -13,6 +13,7 @@ import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.chart.MiddleChartDialog;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.theme.utils.DefaultThemedFloatElement;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.module.DesignModuleFactory;
import com.fr.grid.Grid;
@ -90,7 +91,7 @@ public class ChartFloatAction extends ElementCaseAction {
public void doOk() {
isRecordNeeded = true;
FloatElement newFloatElement;
newFloatElement = new FloatElement(chartDialog.getChartCollection());
newFloatElement = DefaultThemedFloatElement.createInstance(chartDialog.getChartCollection());
newFloatElement.setWidth(new OLDPIX(BaseChartCollection.CHART_DEFAULT_WIDTH));
newFloatElement.setHeight(new OLDPIX(BaseChartCollection.CHART_DEFAULT_HEIGHT));

3
designer-realize/src/main/java/com/fr/design/actions/insert/flot/FormulaFloatAction.java

@ -14,6 +14,7 @@ import com.fr.design.formula.FormulaFactory;
import com.fr.design.formula.UIFormula;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.theme.utils.DefaultThemedFloatElement;
import com.fr.design.menu.MenuKeySet;
import com.fr.grid.Grid;
@ -99,7 +100,7 @@ public class FormulaFloatAction extends ElementCaseAction {
}
reportPane.stopEditing();
final FloatElement floatElement = new FloatElement();
final FloatElement floatElement = DefaultThemedFloatElement.createInstance();
final UIFormula formulaPane = FormulaFactory.createFormulaPane();
formulaPane.populate(BaseFormula.createFormulaBuilder().build());

3
designer-realize/src/main/java/com/fr/design/actions/insert/flot/ImageFloatAction.java

@ -12,6 +12,7 @@ import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.theme.utils.DefaultThemedFloatElement;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.report.SelectImagePane;
@ -73,7 +74,7 @@ public class ImageFloatAction extends ElementCaseAction {
reportPane.stopEditing();
final FloatElement floatElement = new FloatElement();
final FloatElement floatElement = DefaultThemedFloatElement.createInstance();
final SelectImagePane selectImagePane = new SelectImagePane();
selectImagePane.populate(floatElement);

3
designer-realize/src/main/java/com/fr/design/actions/insert/flot/TextBoxFloatAction.java

@ -6,6 +6,7 @@ package com.fr.design.actions.insert.flot;
import com.fr.base.DynamicUnitList;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.theme.utils.DefaultThemedFloatElement;
import com.fr.design.menu.MenuKeySet;
import com.fr.grid.Grid;
@ -59,7 +60,7 @@ public class TextBoxFloatAction extends AbstractShapeAction {
if (jws == null) {
return;
}
FloatElement floatElement = new FloatElement("Text");
FloatElement floatElement = DefaultThemedFloatElement.createInstance("Text");
this.startDraw(floatElement);
doWithDrawingFloatElement();
}

5
designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java

@ -21,6 +21,8 @@ import com.fr.form.main.Form;
import com.fr.form.ui.container.WBorderLayout;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.report.util.ReadXmlType;
import com.fr.report.util.ReadXmlTypeLocalManager;
import com.fr.stable.Constants;
import com.fr.stable.bridge.StableFactory;
import org.jetbrains.annotations.Nullable;
@ -90,13 +92,16 @@ class FormApp extends AbstractAppProvider {
@Nullable
private Form getForm(FILE tplFile) {
ReadXmlTypeLocalManager.setReadXmlType(ReadXmlType.DESIGN);
Form form = asIOFile(tplFile);
ReadXmlTypeLocalManager.remove();
if (form != null) {
DesignerAppUtils.dealWithTemplateIOError(tplFile.getPath());
}
return form;
}
@Override
public Form asIOFile(FILE file) {

Loading…
Cancel
Save