Browse Source

CQ-9 没有装插件的设计打开带有插件控件的表单时,需要能正确的打开并提示

master
richie 8 years ago
parent
commit
fa223daecf
  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
protected JComponent initEditor() {
UILabel l = new UILabel("UNEXPECTED WIDGET");
UILabel l = new UILabel(showText());
l.setForeground(Color.red);
l.setVerticalAlignment(SwingConstants.CENTER);
l.setHorizontalAlignment(SwingConstants.CENTER);
setBorder(DEFALUTBORDER);
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(CardSwitchButton.class, XCardSwitchButton.class);
objectMap.put(CardAddButton.class, XCardAddButton.class);
objectMap.put(ErrorMarker.class, ErrorCreator.class);
putExtraEditor();
xLayoutMap.put(WAbsoluteLayout.class, XWAbsoluteLayout.class);

Loading…
Cancel
Save