Example usage for java.awt Label setVisible

List of usage examples for java.awt Label setVisible

Introduction

In this page you can find the example usage for java.awt Label setVisible.

Prototype

public void setVisible(boolean b) 

Source Link

Document

Shows or hides this component depending on the value of parameter b .

Usage

From source file:com.haulmont.ext.web.ui.Call.CallAccessData.java

public void visitComponent(Component component, Collection<Component> components) {
    if (component instanceof DatasourceComponent) {
        Datasource datasource = ((DatasourceComponent) component).getDatasource();
        if (datasource != null && datasource.getMetaClass().equals((call).getMetaClass())) {
            MetaProperty property = ((DatasourceComponent) component).getMetaProperty();
            FieldInfo fieldInfo = findField(property);
            if (fieldInfo != null) {
                Label label = findLabel(component, components);
                if (!fieldInfo.getVisible()) {
                    component.setVisible(false);
                    if (label != null) {
                        label.setVisible(false);
                    }//from  ww w. j a va 2 s .  c om
                }
                if (fieldInfo.getRequired() && component instanceof Field) {
                    ((Field) component).setRequired(true);
                    if (label != null && label.getText() != null)
                        ((Field) component).setRequiredMessage(
                                MessageProvider.getMessage(getClass(), "error.requiredValue") + " \""
                                        + label.getText().toString() + "\"");
                }
                if (!StringUtils.isBlank(call.getSignatures()) && fieldInfo.getSigned()
                        && component instanceof Field) {
                    ((Field) component).setEditable(false);
                }
            }
            if (!StringUtils.isBlank(call.getSignatures()) && component instanceof Field) {
                SignatureService ss = ServiceLocator.lookup(SignatureService.NAME);
                boolean signed = ss.isPropertySigned(call, property);
                if (((Field) component).isEditable()) {
                    ((Field) component).setEditable(!signed);
                }
            }
        }
    }
}

From source file:com.haulmont.ext.web.ui.CauseGIBDD.CauseGIBDDAccessData.java

public void visitComponent(Component component, Collection<Component> components) {
    if (component instanceof DatasourceComponent) {
        Datasource datasource = ((DatasourceComponent) component).getDatasource();
        if (datasource != null && datasource.getMetaClass().equals((cause).getMetaClass())) {
            MetaProperty property = ((DatasourceComponent) component).getMetaProperty();
            FieldInfo fieldInfo = findField(property);
            if (fieldInfo != null) {
                Label label = findLabel(component, components);
                if (!fieldInfo.getVisible()) {
                    component.setVisible(false);
                    if (label != null) {
                        label.setVisible(false);
                    }// w w w.j  a va 2 s  .  co  m
                }
                if (fieldInfo.getRequired() && component instanceof Field) {
                    ((Field) component).setRequired(true);
                    if (label != null && label.getText() != null)
                        ((Field) component).setRequiredMessage(
                                MessageProvider.getMessage(getClass(), "error.requiredValue") + " \""
                                        + label.getText().toString() + "\"");
                }
                if (!StringUtils.isBlank(cause.getSignatures()) && fieldInfo.getSigned()
                        && component instanceof Field) {
                    ((Field) component).setEditable(false);
                }
            }
            if (!StringUtils.isBlank(cause.getSignatures()) && component instanceof Field) {
                SignatureService ss = ServiceLocator.lookup(SignatureService.NAME);
                boolean signed = ss.isPropertySigned(cause, property);
                if (((Field) component).isEditable()) {
                    ((Field) component).setEditable(!signed);
                }
            }
        }
    }
}