Example usage for java.awt Label getText

List of usage examples for java.awt Label getText

Introduction

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

Prototype

public String getText() 

Source Link

Document

Gets the text of this label.

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);
                    }/*  w  w w  .  j a  v a  2s  . c  o  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(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);
                    }/*from   www . j  a v a2  s. c o 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);
                }
            }
        }
    }
}