Search in sources :

Example 1 with IRuntimeTabPaneAlike

use of com.servoy.j2db.ui.runtime.IRuntimeTabPaneAlike in project servoy-client by Servoy.

the class PropertyCopy method copyElementProps.

public static void copyElementProps(IComponent org, IComponent copy) {
    if (org == null || copy == null)
        return;
    // if (org instanceof IDelegate && copy instanceof IDelegate)
    // {
    // org = (JComponent)((IDelegate)org).getDelegate();
    // copy = (JComponent) ((IDelegate)copy).getDelegate();
    // }
    copy.setLocation(org.getLocation());
    copy.setSize(org.getSize());
    copy.setBackground(org.getBackground());
    copy.setForeground(org.getForeground());
    copy.setToolTipText(org.getToolTipText());
    copy.setComponentVisible(org.isVisible());
    copy.setComponentEnabled(org.isEnabled());
    copy.setOpaque(org.isOpaque());
    copy.setFont(org.getFont());
    if (org instanceof ILabel && copy instanceof ILabel) {
        ((ILabel) copy).setMediaIcon(((ILabel) org).getMediaIcon());
        ((ILabel) copy).setText(((ILabel) org).getText());
    }
    if (org instanceof IFieldComponent && copy instanceof IFieldComponent) {
        ((IFieldComponent) copy).setEditable(((IFieldComponent) org).isEditable());
    }
    if (org instanceof IScriptableProvider && copy instanceof IScriptableProvider) {
        IScriptable source = ((IScriptableProvider) org).getScriptObject();
        IScriptable destination = ((IScriptableProvider) copy).getScriptObject();
        if (source instanceof IFormatScriptComponent && destination instanceof IFormatScriptComponent) {
            ((IFormatScriptComponent) destination).setComponentFormat(((IFormatScriptComponent) source).getComponentFormat());
        }
        if (source instanceof HasRuntimeReadOnly && destination instanceof HasRuntimeReadOnly) {
            ((HasRuntimeReadOnly) destination).setReadOnly(((HasRuntimeReadOnly) source).isReadOnly());
        }
        if (source instanceof HasRuntimeVisible && destination instanceof HasRuntimeVisible) {
            ((HasRuntimeVisible) destination).setVisible(((HasRuntimeVisible) source).isVisible());
        }
        if (source instanceof HasRuntimeImage && destination instanceof HasRuntimeImage) {
            String imageURL = ((HasRuntimeImage) source).getImageURL();
            if (imageURL != null) {
                // only copy if explicitly set with a url
                ((HasRuntimeImage) destination).setImageURL(imageURL);
            }
            String rolloverImageURL = ((HasRuntimeImage) source).getRolloverImageURL();
            if (rolloverImageURL != null) {
                // only copy if explicitly set with a url
                ((HasRuntimeImage) destination).setRolloverImageURL(rolloverImageURL);
            }
        }
        if (source instanceof IRuntimeTabPaneAlike && destination instanceof IRuntimeTabPaneAlike) {
            // keep active tab when printing
            ((IRuntimeTabPaneAlike) destination).setTabIndex(((IRuntimeTabPaneAlike) source).getTabIndex());
        }
    }
    if (org instanceof IProviderStylePropertyChanges && copy instanceof IProviderStylePropertyChanges) {
        ((IProviderStylePropertyChanges) copy).getStylePropertyChanges().setChanges(((IProviderStylePropertyChanges) org).getStylePropertyChanges().getChanges());
    }
}
Also used : HasRuntimeReadOnly(com.servoy.j2db.ui.runtime.HasRuntimeReadOnly) HasRuntimeImage(com.servoy.j2db.ui.runtime.HasRuntimeImage) HasRuntimeVisible(com.servoy.j2db.ui.runtime.HasRuntimeVisible) IRuntimeTabPaneAlike(com.servoy.j2db.ui.runtime.IRuntimeTabPaneAlike) IFormatScriptComponent(com.servoy.j2db.ui.scripting.IFormatScriptComponent) IScriptableProvider(com.servoy.j2db.scripting.IScriptableProvider) IScriptable(com.servoy.j2db.scripting.IScriptable)

Aggregations

IScriptable (com.servoy.j2db.scripting.IScriptable)1 IScriptableProvider (com.servoy.j2db.scripting.IScriptableProvider)1 HasRuntimeImage (com.servoy.j2db.ui.runtime.HasRuntimeImage)1 HasRuntimeReadOnly (com.servoy.j2db.ui.runtime.HasRuntimeReadOnly)1 HasRuntimeVisible (com.servoy.j2db.ui.runtime.HasRuntimeVisible)1 IRuntimeTabPaneAlike (com.servoy.j2db.ui.runtime.IRuntimeTabPaneAlike)1 IFormatScriptComponent (com.servoy.j2db.ui.scripting.IFormatScriptComponent)1