|
|
|
package com.fr.plugin.form.widget.ui;
|
|
|
|
|
|
|
|
import com.fr.design.designer.creator.CRPropertyDescriptor;
|
|
|
|
import com.fr.design.designer.creator.XWidgetCreator;
|
|
|
|
import com.fanruan.api.design.work.form.macro.XCreatorConstants;
|
|
|
|
import com.fanruan.api.design.ui.component.UITextField;
|
|
|
|
import com.fanruan.api.design.util.GUICoreKit;
|
|
|
|
import com.fanruan.api.design.DesignKit;
|
|
|
|
import com.fr.plugin.form.widget.core.RHIframe;
|
|
|
|
import com.fr.plugin.form.widget.core.RHIframeAttr;
|
|
|
|
import com.fr.plugin.form.widget.core.RHIframeSource;
|
|
|
|
import com.fr.plugin.form.widget.ui.editor.RHIframeModelEditor;
|
|
|
|
import com.fr.plugin.form.widget.ui.render.RHIframeModelRenderer;
|
|
|
|
import com.fanruan.api.util.ArrayKit;
|
|
|
|
import com.fanruan.api.util.StringKit;
|
|
|
|
|
|
|
|
import javax.swing.*;
|
|
|
|
import java.awt.*;
|
|
|
|
import java.beans.IntrospectionException;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Created by richie on 15/12/2.
|
|
|
|
*/
|
|
|
|
public class XRHIframe extends XWidgetCreator {
|
|
|
|
|
|
|
|
private UITextField address;
|
|
|
|
|
|
|
|
public XRHIframe(RHIframe widget, Dimension initSize) {
|
|
|
|
super(widget, initSize);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException {
|
|
|
|
return ArrayKit.addAll(super.supportedDescriptor(), new CRPropertyDescriptor[]{
|
|
|
|
new CRPropertyDescriptor("attr", this.toData().getClass())
|
|
|
|
.setI18NName(DesignKit.i18nText("Plugin-RH_Iframe_Value"))
|
|
|
|
.setEditorClass(RHIframeModelEditor.class)
|
|
|
|
.setRendererClass(RHIframeModelRenderer.class),
|
|
|
|
new CRPropertyDescriptor("overflowX", this.data.getClass()).setI18NName(
|
|
|
|
DesignKit.i18nText("Plugin-Preference_Horizontal_Scroll_Bar_Visible")).putKeyValue(
|
|
|
|
XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
|
|
|
|
new CRPropertyDescriptor("overflowY", this.data.getClass()).setI18NName(
|
|
|
|
DesignKit.i18nText("Plugin-Preference_Vertical_Scroll_Bar_Visible")).putKeyValue(
|
|
|
|
XCreatorConstants.PROPERTY_CATEGORY, "Plugin-RH_Iframe_Advanced")});
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected JComponent initEditor() {
|
|
|
|
if (editor == null) {
|
|
|
|
editor = GUICoreKit.createBorderLayoutPane();
|
|
|
|
address = new UITextField(showDescriptionText());
|
|
|
|
editor.add(address, BorderLayout.NORTH);
|
|
|
|
JPanel contentPane = GUICoreKit.createNormalFlowInnerContainerPane();
|
|
|
|
contentPane.setBackground(Color.white);
|
|
|
|
editor.add(contentPane, BorderLayout.CENTER);
|
|
|
|
}
|
|
|
|
return editor;
|
|
|
|
}
|
|
|
|
|
|
|
|
private String showDescriptionText() {
|
|
|
|
RHIframe iframe = (RHIframe) toData();
|
|
|
|
if (iframe != null) {
|
|
|
|
RHIframeAttr attr = iframe.getAttr();
|
|
|
|
if (attr != null) {
|
|
|
|
RHIframeSource source = iframe.getAttr().getSource();
|
|
|
|
if (source != null) {
|
|
|
|
return source.toString();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return StringKit.EMPTY;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public Dimension initEditorSize() {
|
|
|
|
return new Dimension(160, 80);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 该组件是否可以拖入参数面板
|
|
|
|
* 这里控制 网页预定义控件在工具栏不显示
|
|
|
|
*
|
|
|
|
* @return 是则返回true
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public boolean canEnterIntoParaPane() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void paint(Graphics g) {
|
|
|
|
address.setText(showDescriptionText());
|
|
|
|
super.paint(g);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String getIconPath() {
|
|
|
|
return "/com/fr/plugin/form/widget/images/rh_iframe.png";
|
|
|
|
}
|
|
|
|
}
|