Browse Source

Merge pull request #964 in BA/design from ~RICHIE/design:release to release

* commit 'fdf468ecf326fd24c86c9a7a530fba853dcf9e87':
  CQ-9 没有装插件的设计打开带有插件控件的表单时,需要能正确的打开并提示
master
superman 8 years ago
parent
commit
2124e5f7ab
  1. 28
      designer_form/src/com/fr/design/designer/creator/ErrorCreator.java
  2. 6
      designer_form/src/com/fr/design/designer/creator/NullCreator.java
  3. 3
      designer_form/src/com/fr/design/designer/creator/XCreatorUtils.java

28
designer_form/src/com/fr/design/designer/creator/ErrorCreator.java

@ -0,0 +1,28 @@
package com.fr.design.designer.creator;
import com.fr.form.ui.ErrorMarker;
import com.fr.form.ui.Widget;
import com.fr.stable.StringUtils;
import java.awt.*;
/**
* Created by richie on 2017/6/28.
*/
public class ErrorCreator extends NullCreator {
public ErrorCreator(Widget widget, Dimension initSize) {
super(widget, initSize);
}
@Override
protected String showText() {
ErrorMarker marker = (ErrorMarker)toData();
String text = marker.getWidgetValue().getDisplayValue();
if (StringUtils.isEmpty(text)) {
return super.showText();
}
return text;
}
}

6
designer_form/src/com/fr/design/designer/creator/NullCreator.java

@ -23,11 +23,15 @@ public class NullCreator extends XWidgetCreator {
@Override @Override
protected JComponent initEditor() { protected JComponent initEditor() {
UILabel l = new UILabel("UNEXPECTED WIDGET"); UILabel l = new UILabel(showText());
l.setForeground(Color.red); l.setForeground(Color.red);
l.setVerticalAlignment(SwingConstants.CENTER); l.setVerticalAlignment(SwingConstants.CENTER);
l.setHorizontalAlignment(SwingConstants.CENTER); l.setHorizontalAlignment(SwingConstants.CENTER);
setBorder(DEFALUTBORDER); setBorder(DEFALUTBORDER);
return editor = l; return editor = l;
} }
protected String showText() {
return "UNEXPECTED WIDGET";
}
} }

3
designer_form/src/com/fr/design/designer/creator/XCreatorUtils.java

@ -73,6 +73,9 @@ public class XCreatorUtils {
objectMap.put(NameWidget.class, XNameWidget.class); objectMap.put(NameWidget.class, XNameWidget.class);
objectMap.put(CardSwitchButton.class, XCardSwitchButton.class); objectMap.put(CardSwitchButton.class, XCardSwitchButton.class);
objectMap.put(CardAddButton.class, XCardAddButton.class); objectMap.put(CardAddButton.class, XCardAddButton.class);
objectMap.put(ErrorMarker.class, ErrorCreator.class);
putExtraEditor(); putExtraEditor();
xLayoutMap.put(WAbsoluteLayout.class, XWAbsoluteLayout.class); xLayoutMap.put(WAbsoluteLayout.class, XWAbsoluteLayout.class);

Loading…
Cancel
Save