Browse Source

CHART-19757 图表块增加名称检测

feature/10.0
白岳 3 years ago
parent
commit
0e019e3742
  1. 24
      designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java

24
designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java

@ -19,6 +19,7 @@ import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.EastRegionContainerPane;
@ -31,12 +32,12 @@ import com.fr.design.widget.Operator;
import com.fr.design.widget.ui.designer.component.WidgetAbsoluteBoundPane;
import com.fr.design.widget.ui.designer.component.WidgetBoundPane;
import com.fr.design.widget.ui.designer.component.WidgetCardTagBoundPane;
import com.fr.form.ui.ChartEditor;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WScaleLayout;
import com.fr.form.ui.container.WTitleLayout;
import com.fr.form.ui.widget.CRBoundsWidget;
import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
import com.fr.stable.StringUtils;
@ -229,17 +230,26 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
public void updateCreator() {
currentEditorDefinePane.setGlobalName(getGlobalName());
Widget widget = currentEditorDefinePane.updateBean();
if (ComparatorUtils.equals(getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Basic")) && widgetPropertyPane != null) {
if (ComparatorUtils.equals(getGlobalName(), Toolkit.i18nText("Fine-Design_Report_Basic")) && widgetPropertyPane != null) {
UITextField widgetNameField = widgetPropertyPane.getWidgetNameField();
String toSetWidgetName = widgetNameField.getText();
String currentWidgetName = widget.getWidgetName();
boolean exist = designer.getTarget().isNameExist(toSetWidgetName, widget) && !ComparatorUtils.equals(toSetWidgetName, currentWidgetName);
if (toSetWidgetName.isEmpty()) {
widgetNameField.setText(currentWidgetName);
return;
} else if (exist) {
}
boolean exist = designer.getTarget().isNameExist(toSetWidgetName, widget) && !ComparatorUtils.equals(toSetWidgetName, currentWidgetName);
if (exist) {
widgetNameField.setText(currentWidgetName);
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Rename_Failure"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Joption_News"), JOptionPane.ERROR_MESSAGE, IOUtils.readIcon("com/fr/design/form/images/joption_failure.png"));
showNameInvalidDialog(Toolkit.i18nText("Fine-Design_Form_Widget_Rename_Failure"));
return;
}
//图表名称的合法性检查
if (widget instanceof ChartEditor && toSetWidgetName.startsWith("Chart")) {
widgetNameField.setText(currentWidgetName);
showNameInvalidDialog(Toolkit.i18nText("Fine-Design_Form_Chart_Widget_Rename_Failure"));
return;
}
widgetPropertyPane.update(widget);
@ -252,6 +262,10 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
fireValueChanged();
}
private void showNameInvalidDialog(String message) {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), message, Toolkit.i18nText("Fine-Design_Form_Joption_News"), JOptionPane.ERROR_MESSAGE, IOUtils.readIcon("com/fr/design/form/images/joption_failure.png"));
}
public void updateWidgetBound() {
if (widgetBoundPane != null && ComparatorUtils.equals(getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size"))) {
widgetBoundPane.update();

Loading…
Cancel
Save