PL-8298 TextField/Label getRawValue API

This commit is contained in:
Daniil Tsarev 2016-12-06 17:48:36 +04:00
parent d27e56eef8
commit 1a03c801eb
14 changed files with 72 additions and 2 deletions

View File

@ -31,9 +31,9 @@ import com.haulmont.cuba.desktop.sys.DesktopToolTipManager;
import com.haulmont.cuba.gui.ComponentsHelper;
import com.haulmont.cuba.gui.components.Formatter;
import com.haulmont.cuba.gui.components.Label;
import com.haulmont.cuba.gui.components.compatibility.ComponentValueListenerWrapper;
import com.haulmont.cuba.gui.data.Datasource;
import com.haulmont.cuba.gui.data.ValueListener;
import com.haulmont.cuba.gui.components.compatibility.ComponentValueListenerWrapper;
import com.haulmont.cuba.gui.data.impl.WeakItemChangeListener;
import com.haulmont.cuba.gui.data.impl.WeakItemPropertyChangeListener;
import org.apache.commons.lang.ObjectUtils;
@ -272,6 +272,11 @@ public class DesktopLabel extends DesktopAbstractComponent<JLabel> implements La
this.htmlEnabled = htmlEnabled;
}
@Override
public String getRawValue() {
return this.labelText;
}
protected void resolveMetaPropertyPath(MetaClass metaClass, String property) {
metaPropertyPath = AppBeans.get(MetadataTools.NAME, MetadataTools.class)
.resolveMetaPropertyPath(metaClass, property);

View File

@ -215,4 +215,9 @@ public class DesktopSourceCodeEditor extends DesktopAbstractTextField<RSyntaxTex
public String getValue() {
return super.getValue();
}
@Override
public String getRawValue() {
return impl.getText();
}
}

View File

@ -252,6 +252,11 @@ public class DesktopTextArea extends DesktopAbstractTextField<JTextArea> impleme
this.valueFormatter.setDatatype(datatype);
}
@Override
public String getRawValue() {
return impl.getText();
}
@Override
public Datatype getDatatype() {
return datatype;

View File

@ -164,6 +164,11 @@ public class DesktopTextField extends DesktopAbstractTextField<JTextComponent> i
this.caseConversion = caseConversion;
}
@Override
public String getRawValue() {
return impl.getText();
}
protected class FlushableTextField extends JTextField implements Flushable {
@Override

View File

@ -23,4 +23,9 @@ public interface Label
boolean isHtmlEnabled();
void setHtmlEnabled(boolean htmlEnabled);
/**
* Returns a string representation of the value.
*/
String getRawValue();
}

View File

@ -92,4 +92,9 @@ public interface SourceCodeEditor extends Field {
@SuppressWarnings("unchecked")
@Override
String getValue();
/**
* Returns a string representation of the value.
*/
String getRawValue();
}

View File

@ -38,4 +38,9 @@ public interface TextArea extends TextInputField,
Datatype getDatatype();
void setDatatype(Datatype datatype);
/**
* Returns a string representation of the value.
*/
String getRawValue();
}

View File

@ -32,4 +32,9 @@ public interface TextField
Datatype getDatatype();
void setDatatype(Datatype datatype);
/**
* Returns a string representation of the value.
*/
String getRawValue();
}

View File

@ -251,6 +251,11 @@ public class WebLabel extends WebAbstractComponent<com.vaadin.ui.Label> implemen
component.setContentMode(htmlEnabled ? ContentMode.HTML : ContentMode.TEXT);
}
@Override
public String getRawValue() {
return component.getValue();
}
protected MetaPropertyPath resolveMetaPropertyPath(MetaClass metaClass, String property) {
MetaPropertyPath metaPropertyPath = AppBeans.get(MetadataTools.NAME, MetadataTools.class)
.resolveMetaPropertyPath(metaClass, property);

View File

@ -68,6 +68,11 @@ public class WebMaskedField extends WebAbstractTextField<CubaMaskedTextField> im
//Do nothing
}
@Override
public String getRawValue() {
return component.getValue();
}
@Override
protected CubaMaskedTextField createTextFieldImpl() {
return new CubaMaskedTextField();

View File

@ -247,6 +247,11 @@ public class WebResizableTextArea extends WebAbstractTextArea<CubaTextArea> impl
}
}
@Override
public String getRawValue() {
return component.getValue();
}
@Override
public CaseConversion getCaseConversion() {
return CaseConversion.valueOf(component.getCaseConversion().name());

View File

@ -18,9 +18,9 @@
package com.haulmont.cuba.web.gui.components;
import com.google.common.base.Strings;
import com.haulmont.cuba.gui.components.SourceCodeEditor;
import com.haulmont.cuba.gui.components.autocomplete.AutoCompleteSupport;
import com.haulmont.cuba.gui.components.autocomplete.Suggester;
import com.haulmont.cuba.gui.components.SourceCodeEditor;
import com.haulmont.cuba.web.toolkit.ui.CubaSourceCodeEditor;
import org.apache.commons.lang.StringUtils;
import org.vaadin.aceeditor.AceMode;
@ -198,6 +198,11 @@ public class WebSourceCodeEditor extends WebAbstractField<CubaSourceCodeEditor>
return Strings.emptyToNull(value);
}
@Override
public String getRawValue() {
return component.getValue();
}
protected class SourceCodeEditorSuggester implements org.vaadin.aceeditor.Suggester {
@Override
public List<Suggestion> getSuggestions(String text, int cursor) {

View File

@ -69,6 +69,11 @@ public class WebTextArea extends WebAbstractTextArea<CubaTextArea> implements co
}
}
@Override
public String getRawValue() {
return component.getValue();
}
@Override
public CaseConversion getCaseConversion() {
return CaseConversion.valueOf(component.getCaseConversion().name());

View File

@ -119,4 +119,9 @@ public class WebTextField extends WebAbstractTextField<CubaTextField> implements
public void setCursorPosition(int position) {
component.setCursorPosition(position);
}
@Override
public String getRawValue() {
return component.getValue();
}
}