diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index 6129f87462..14a86fe0a4 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -51,6 +51,7 @@ import com.fr.design.menu.MenuDef; import com.fr.design.menu.NameSeparator; import com.fr.design.menu.ShortCut; import com.fr.design.preview.PagePreview; +import com.fr.design.utils.DesignUtils; import com.fr.design.write.submit.DBManipulationInWidgetEventPane; import com.fr.design.write.submit.DBManipulationPane; import com.fr.file.FILE; @@ -77,7 +78,6 @@ import com.fr.stable.StringUtils; import com.fr.stable.core.UUID; import com.fr.workspace.WorkContext; import com.fr.workspace.server.lock.TplOperator; - import javax.swing.BorderFactory; import javax.swing.Icon; import javax.swing.JComponent; @@ -1339,9 +1339,12 @@ public abstract class JTemplate> } }); + preferenceButton.setEnabled(DesignUtils.checkDesignerRemoteVersion()); return preferenceButton; } + + private void setPredefinedButtonSize(UIButton predefinedBtn) { String text = predefinedBtn.getText(); FontMetrics metrics = predefinedBtn.getFontMetrics(predefinedBtn.getFont()); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/ServerPredefinedStylePane.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/ServerPredefinedStylePane.java index 90b013e0e9..76b2a3b60d 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/ServerPredefinedStylePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/ServerPredefinedStylePane.java @@ -190,7 +190,9 @@ public class ServerPredefinedStylePane extends BasicPane { PredefinedStyleEditPane editPane = PredefinedStyleEditPane.createNewEditPane(selectPane); PredefinedStyleEditDialog editDialog = new PredefinedStyleEditDialog( SwingUtilities.getWindowAncestor(ServerPredefinedStylePane.this), editPane); - editPane.populate(style.getPredefinedStyle()); + PredefinedStyle predefinedStyle = style.getPredefinedStyle(); + predefinedStyle.setStyleName(StringUtils.EMPTY); + editPane.populate(predefinedStyle); editDialog.setVisible(true); } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/ComponentStyleSettingPane.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/ComponentStyleSettingPane.java index 5a7ea8502d..e2d306933c 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/ComponentStyleSettingPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/ComponentStyleSettingPane.java @@ -4,7 +4,6 @@ import com.fr.config.predefined.PredefinedComponentStyle; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.MultiTabPane; import com.fr.design.mainframe.predefined.ui.detail.component.ComponentFrameStylePane; -import com.fr.design.mainframe.predefined.ui.detail.component.ComponentMarginStylePane; import com.fr.design.mainframe.predefined.ui.detail.component.ComponentTitleStylePane; import java.util.ArrayList; @@ -16,7 +15,6 @@ import java.util.List; public class ComponentStyleSettingPane extends MultiTabPane { private ComponentFrameStylePane frameStylePane; private ComponentTitleStylePane titleStylePane; - private ComponentMarginStylePane marginStylePane; public ComponentStyleSettingPane() { } @@ -26,11 +24,9 @@ public class ComponentStyleSettingPane extends MultiTabPane initPaneList() { this.frameStylePane = new ComponentFrameStylePane(); this.titleStylePane = ComponentTitleStylePane.createPredefinedSettingPane(); - this.marginStylePane = new ComponentMarginStylePane(); paneList = new ArrayList(); paneList.add(this.frameStylePane); paneList.add(this.titleStylePane); - paneList.add(this.marginStylePane); return paneList; } @@ -38,7 +34,6 @@ public class ComponentStyleSettingPane extends MultiTabPane { +public class FormPredefinedBackgroundPane extends PredefinedStyleSettingPane { private BackgroundWithAlphaSettingPane backgroundPane; @Override @@ -42,7 +43,7 @@ public class FormPredefinedBackgroundPane extends PredefinedStyleSettingPane { +public class PredefinedComponentStyleSettingPane extends PredefinedStyleSettingPane { private StyleSettingPane styleSettingPane; private TinyFormulaPane formulaPane; @@ -52,11 +48,10 @@ public class PredefinedComponentStyleSettingPane extends PredefinedStyleSettingP } @Override - public void populateBean(ComponentStyle ob) { + public void populateBean(NameLayoutBorderStyle ob) { this.setPopulating(true); - NameLayoutBorderStyle layoutBorderStyle = ob.getNameLayoutBorderStyle(); - super.populate(layoutBorderStyle); - this.formulaPane.populateBean(layoutBorderStyle.getTitleText().toString()); + super.populate(ob); + this.formulaPane.populateBean(ob.getTitleText().toString()); styleSettingPane.populateBean(ob); this.previewPane.refresh(); this.setPopulating(false); @@ -64,12 +59,11 @@ public class PredefinedComponentStyleSettingPane extends PredefinedStyleSettingP @Override - public ComponentStyle updateBean() { + public NameLayoutBorderStyle updateBean() { if (predefinedRadioBtn.isSelected()) { NameLayoutBorderStyle layoutBorderStyle = NameLayoutBorderStyle.createPredefinedStyle(getPredefinedStyleName()); layoutBorderStyle.setTitleText(formulaPane.updateBean()); - return new ComponentStyle(layoutBorderStyle, - NamePaddingMargin.createPredefinedStyle(getPredefinedStyleName())); + return layoutBorderStyle; } return styleSettingPane.updateBean(); } @@ -79,10 +73,9 @@ public class PredefinedComponentStyleSettingPane extends PredefinedStyleSettingP return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Style"); } - class StyleSettingPane extends BasicBeanPane { + class StyleSettingPane extends BasicBeanPane { private ComponentFrameStylePane frameStylePane; private ComponentTitleStylePane titleStylePane; - private ComponentMarginStylePane marginStylePane; public StyleSettingPane() { initPane(); @@ -92,53 +85,37 @@ public class PredefinedComponentStyleSettingPane extends PredefinedStyleSettingP this.setLayout(FRGUIPaneFactory.createBorderLayout()); JPanel frame = FRGUIPaneFactory.createTitledBorderNoGapPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Frame")); frameStylePane = new ComponentFrameStylePane(); - frameStylePane.setPreferredSize(new Dimension(233, 183)); + frameStylePane.setPreferredSize(new Dimension(233, 225)); frame.add(frameStylePane); JPanel title = FRGUIPaneFactory.createTitledBorderNoGapPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Title")); titleStylePane = ComponentTitleStylePane.createStyleSettingPane(); - titleStylePane.setPreferredSize(new Dimension(233, 140)); + titleStylePane.setPreferredSize(new Dimension(233, 220)); title.add(titleStylePane); - - JPanel margin = FRGUIPaneFactory.createTitledBorderNoGapPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Base_Margin")); - marginStylePane = new ComponentMarginStylePane(); - marginStylePane.setPreferredSize(new Dimension(233, 100)); - margin.add(marginStylePane); - this.add(frame, BorderLayout.NORTH); this.add(title, BorderLayout.CENTER); - this.add(margin, BorderLayout.SOUTH); } @Override - public void populateBean(ComponentStyle ob) { + public void populateBean(NameLayoutBorderStyle ob) { PredefinedComponentStyle componentStyle = new PredefinedComponentStyle(); - componentStyle.setBorderStyle(ob.getNameLayoutBorderStyle().createRealStyle()); - PaddingMargin margin = ob.getNamePaddingMargin().createRealStyle(); - componentStyle.setTop(margin.getTop()); - componentStyle.setBottom(margin.getBottom()); - componentStyle.setLeft(margin.getLeft()); - componentStyle.setRight(margin.getRight()); + componentStyle.setBorderStyle(ob.createRealStyle()); frameStylePane.populate(componentStyle); titleStylePane.populate(componentStyle); - marginStylePane.populate(componentStyle); } @Override - public ComponentStyle updateBean() { + public NameLayoutBorderStyle updateBean() { PredefinedComponentStyle componentStyle = update(); NameLayoutBorderStyle nameLayoutBorderStyle = NameLayoutBorderStyle.createCustomStyle(componentStyle.getBorderStyle()); - NamePaddingMargin namePaddingMargin = NamePaddingMargin.createCustomStyle( - new PaddingMargin(componentStyle.getTop(), componentStyle.getLeft(), componentStyle.getBottom(), componentStyle.getRight())); - return new ComponentStyle(nameLayoutBorderStyle, namePaddingMargin); + return nameLayoutBorderStyle; } public PredefinedComponentStyle update() { PredefinedComponentStyle componentStyle = new PredefinedComponentStyle(); frameStylePane.update(componentStyle); titleStylePane.update(componentStyle); - marginStylePane.update(componentStyle); return componentStyle; } @@ -159,9 +136,8 @@ public class PredefinedComponentStyleSettingPane extends PredefinedStyleSettingP } public void refresh() { - ComponentStyle componentStyle = PredefinedComponentStyleSettingPane.this.updateBean(); - NameLayoutBorderStyle borderStyle = componentStyle.getNameLayoutBorderStyle(); - this.layoutBorderPreviewPane.repaint((LayoutBorderStyle) borderStyle.createRealStyle()); + NameLayoutBorderStyle componentStyle = PredefinedComponentStyleSettingPane.this.updateBean(); + this.layoutBorderPreviewPane.repaint((LayoutBorderStyle) componentStyle.createRealStyle()); } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleBodyBackgroundEditor.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleBodyBackgroundEditor.java index 2b30721825..fd3430a8c1 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleBodyBackgroundEditor.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleBodyBackgroundEditor.java @@ -8,7 +8,7 @@ import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.gui.xpane.FormPredefinedBackgroundPane; import com.fr.design.mainframe.widget.editors.ITextComponent; import com.fr.design.mainframe.widget.renderer.EncoderCellRenderer; -import com.fr.form.ui.NameFormBackground; +import com.fr.form.ui.NameComponentBackground; import javax.swing.SwingUtilities; import java.awt.Dimension; @@ -43,7 +43,7 @@ public class AccessibleBodyBackgroundEditor extends UneditableAccessibleEditor { fireStateChanged(); } }); - backgroundPane.populateBean((NameFormBackground) getValue()); + backgroundPane.populateBean((NameComponentBackground) getValue()); dlg.setVisible(true); } @@ -62,7 +62,7 @@ public class AccessibleBodyBackgroundEditor extends UneditableAccessibleEditor { if (v == null) { return null; } - NameFormBackground style = (NameFormBackground) v; + NameComponentBackground style = (NameComponentBackground) v; return style.usePredefinedStyle() ? com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Predefined") : com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom"); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleBorderStyleEditor.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleBorderStyleEditor.java index d6e14d1b85..f723474f0b 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleBorderStyleEditor.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleBorderStyleEditor.java @@ -8,7 +8,7 @@ import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.gui.xpane.PredefinedComponentStyleSettingPane; import com.fr.design.mainframe.widget.editors.ITextComponent; import com.fr.design.mainframe.widget.renderer.EncoderCellRenderer; -import com.fr.design.widget.ui.designer.layout.ComponentStyle; +import com.fr.form.ui.NameLayoutBorderStyle; import javax.swing.SwingUtilities; import java.awt.Dimension; @@ -43,7 +43,7 @@ public class AccessibleBorderStyleEditor extends UneditableAccessibleEditor { fireStateChanged(); } }); - borderPane.populateBean((ComponentStyle) getValue()); + borderPane.populateBean((NameLayoutBorderStyle) getValue()); dlg.setVisible(true); } @@ -63,7 +63,7 @@ public class AccessibleBorderStyleEditor extends UneditableAccessibleEditor { if (v == null) { return null; } - ComponentStyle style = (ComponentStyle) v; + NameLayoutBorderStyle style = (NameLayoutBorderStyle) v; return style.usePredefinedStyle() ? com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Predefined") : com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Custom"); } diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/BorderStyleWidgetDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/BorderStyleWidgetDefinePane.java index 4a2ac45c28..451b0b3c4b 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/BorderStyleWidgetDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/BorderStyleWidgetDefinePane.java @@ -10,6 +10,7 @@ import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.widget.accessibles.AccessibleBorderStyleEditor; import com.fr.design.widget.ui.designer.AbstractDataModify; import com.fr.form.ui.AbstractBorderStyleWidget; +import com.fr.form.ui.NameLayoutBorderStyle; import javax.swing.*; @@ -49,17 +50,15 @@ public class BorderStyleWidgetDefinePane extends AbstractDataModify { + private PaddingBoundPane paddingBoundPane; private AccessibleElementCaseToolBarEditor elementCaseToolBarEditor; private PropertyGroupPane extraPropertyGroupPane; @@ -27,8 +31,10 @@ public class ElementEditorDefinePane extends WTitleLayoutDefinePane allStyle = config.getAllStyles(); this.applicationFormat.clearBoxItems(); for (String name : allStyle.keySet()) { diff --git a/designer-realize/src/main/java/com/fr/design/style/BorderUtils.java b/designer-realize/src/main/java/com/fr/design/style/BorderUtils.java index 48c3c05aa4..3a7142b4e3 100644 --- a/designer-realize/src/main/java/com/fr/design/style/BorderUtils.java +++ b/designer-realize/src/main/java/com/fr/design/style/BorderUtils.java @@ -7,6 +7,7 @@ import java.util.Hashtable; import java.util.List; import com.fr.base.CellBorderStyle; +import com.fr.base.NameStyle; import com.fr.base.Style; import com.fr.design.mainframe.ElementCasePane; import com.fr.general.ComparatorUtils; @@ -14,6 +15,7 @@ import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.FloatSelection; import com.fr.grid.selection.Selection; import com.fr.report.cell.CellElement; +import com.fr.report.cell.DefaultPredefinedTemplateCellElement; import com.fr.report.cell.DefaultTemplateCellElement; import com.fr.report.cell.FloatElement; import com.fr.report.cell.TemplateCellElement; @@ -511,10 +513,13 @@ public abstract class BorderUtils { for (int j = row; j < row + rowSpan; j++) { TemplateCellElement tmpCellElement = report.getTemplateCellElement(i, j); if (tmpCellElement == null) { - tmpCellElement = new DefaultTemplateCellElement(i, j); + tmpCellElement = new DefaultPredefinedTemplateCellElement(i, j); report.addCellElement(tmpCellElement); } Style style = tmpCellElement.getStyle(); + if (style instanceof NameStyle && ((NameStyle) style).usePredefinedStyle()) { + continue; + } style = inspectStyle(row, column, rowSpan, columnSpan, cellBorderStyle, newCellBorderStyle, tmpCellElement, style); tmpCellElement.setStyle(style); } @@ -675,4 +680,4 @@ public abstract class BorderUtils { return false; } } -} \ No newline at end of file +} diff --git a/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java b/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java index 393aa36683..cd89f3e4d9 100644 --- a/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java +++ b/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java @@ -9,7 +9,6 @@ import com.fr.base.vcs.DesignerMode; import com.fr.cache.list.IntList; import com.fr.config.ServerPreferenceConfig; import com.fr.config.predefined.PredefinedStyle; -import com.fr.config.predefined.PredefinedStyleConfig; import com.fr.design.actions.UpdateAction; import com.fr.design.actions.cell.CellAttributeAction; import com.fr.design.actions.cell.CellExpandAttrAction; @@ -45,6 +44,7 @@ import com.fr.design.report.RowColumnPane; import com.fr.design.selection.QuickEditor; import com.fr.grid.GridUtils; +import com.fr.predefined.PredefinedPatternStyleManager; import com.fr.report.cell.CellElement; import com.fr.report.cell.DefaultTemplateCellElement; import com.fr.report.cell.TemplateCellElement; @@ -480,19 +480,16 @@ public class CellSelection extends Selection { if (!ServerPreferenceConfig.getInstance().hasStyle()) { UIMenu styleMenu = new UIMenu(KeySetUtils.GLOBAL_STYLE.getMenuName()); styleMenu.setIcon(BaseUtils.readIcon("/com/fr/design/images/m_format/cell.png")); - PredefinedStyleConfig config = ServerPreferenceConfig.getInstance().getPreferenceStyleConfig(); String styleName = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getTemplatePredefinedStyle(); - PredefinedStyle currentStyle = config.getStyle(styleName); - if (currentStyle != null) { - Iterator iterator = config.getStyle(styleName).getCellStyleConfig().getStyleNameIterator(); - while (iterator.hasNext()) { - String name = (String) iterator.next(); - name = GlobalStyleMenuDef.judgeChina(name); - NameStyle nameStyle = NameStyle.createPredefinedStyle(styleName, name, Style.getInstance()); - UpdateAction.UseMenuItem useMenuItem = new GlobalStyleSelection(ePane, nameStyle).createUseMenuItem(); - useMenuItem.setNameStyle(nameStyle); - styleMenu.add(useMenuItem); - } + PredefinedStyle currentStyle = PredefinedPatternStyleManager.INSTANCE.getStyleFromName(styleName); + Iterator iterator = currentStyle.getCellStyleConfig().getStyleNameIterator(); + while (iterator.hasNext()) { + String name = (String) iterator.next(); + name = GlobalStyleMenuDef.judgeChina(name); + NameStyle nameStyle = NameStyle.createPredefinedStyle(styleName, name, Style.getInstance()); + UpdateAction.UseMenuItem useMenuItem = new GlobalStyleSelection(ePane, nameStyle).createUseMenuItem(); + useMenuItem.setNameStyle(nameStyle); + styleMenu.add(useMenuItem); } styleMenu.addSeparator(); styleMenu.add(new GlobalStyleMenuDef.CustomStyleAction(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom")));