![JAR search and dependency download from the Maven repository](/logo.png)
xy.reflect.ui.control.swing.customizer.CustomizingFieldControlPlaceHolder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of custom-ui Show documentation
Show all versions of custom-ui Show documentation
Customizations editor for ReflectionUI
The newest version!
package xy.reflect.ui.control.swing.customizer;
import java.awt.BorderLayout;
import java.awt.Component;
import xy.reflect.ui.control.swing.renderer.FieldControlPlaceHolder;
import xy.reflect.ui.control.swing.util.SwingRendererUtils;
import xy.reflect.ui.info.field.IFieldInfo;
/**
* This is a sub-class of {@link FieldControlPlaceHolder} that allows to install
* field customization tools.
*
* @author olitank
*
*/
public class CustomizingFieldControlPlaceHolder extends FieldControlPlaceHolder {
private static final long serialVersionUID = 1L;
protected Component infoCustomizationsComponent;
public CustomizingFieldControlPlaceHolder(CustomizingForm form, IFieldInfo field) {
super(form, field);
}
@Override
public void refreshUI(boolean recreate) {
refreshInfoCustomizationsControl();
super.refreshUI(recreate);
}
public void refreshInfoCustomizationsControl() {
if (!(((CustomizingForm) form)
.areCustomizationsEditable(getObject()) == (infoCustomizationsComponent != null))) {
if (infoCustomizationsComponent == null) {
infoCustomizationsComponent = ((SwingCustomizer) swingRenderer).getCustomizationTools()
.makeButtonForField(this);
add(infoCustomizationsComponent, BorderLayout.EAST);
SwingRendererUtils.handleComponentSizeChange(this);
} else {
remove(infoCustomizationsComponent);
infoCustomizationsComponent = null;
refreshInfoCustomizationsControl();
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy