/* * Copyright 2000-2022 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package com.vaadin.v7.ui.renderers; import com.vaadin.server.AbstractJavaScriptExtension; import com.vaadin.server.JavaScriptCallbackHelper; import com.vaadin.server.JsonCodec; import com.vaadin.shared.JavaScriptExtensionState; import com.vaadin.shared.communication.ServerRpc; import com.vaadin.ui.JavaScriptFunction; import com.vaadin.v7.ui.Grid.AbstractRenderer; import elemental.json.Json; import elemental.json.JsonValue; /** * Base class for Renderers with all client-side logic implemented using * JavaScript. *

* When a new JavaScript renderer is initialized in the browser, the framework * will look for a globally defined JavaScript function that will initialize the * renderer. The name of the initialization function is formed by replacing . * with _ in the name of the server-side class. If no such function is defined, * each super class is used in turn until a match is found. The framework will * thus first attempt with com_example_MyRenderer for the * server-side * com.example.MyRenderer extends AbstractJavaScriptRenderer class. * If MyRenderer instead extends com.example.SuperRenderer , then * com_example_SuperRenderer will also be attempted if * com_example_MyRenderer has not been defined. *

* * In addition to the general JavaScript extension functionality explained in * {@link AbstractJavaScriptExtension}, this class also provides some * functionality specific for renderers. *

* The initialization function will be called with this pointing to * a connector wrapper object providing integration to Vaadin. Please note that * in JavaScript, this is not necessarily defined inside callback * functions and it might therefore be necessary to assign the reference to a * separate variable, e.g. var self = this;. In addition to the * extension functions described for {@link AbstractJavaScriptExtension}, the * connector wrapper object also provides this function: *

* The connector wrapper also supports these special functions that can be * implemented by the connector: * * *

* The cell object passed to functions defined by the renderer has these * properties: *

* * @author Vaadin Ltd * @since 7.4 */ @Deprecated public abstract class AbstractJavaScriptRenderer extends AbstractRenderer { private JavaScriptCallbackHelper callbackHelper = new JavaScriptCallbackHelper( this); protected AbstractJavaScriptRenderer(Class presentationType, String nullRepresentation) { super(presentationType, nullRepresentation); } protected AbstractJavaScriptRenderer(Class presentationType) { super(presentationType, null); } @Override protected void registerRpc(R implementation, Class rpcInterfaceType) { super.registerRpc(implementation, rpcInterfaceType); callbackHelper.registerRpc(rpcInterfaceType); } /** * Register a {@link JavaScriptFunction} that can be called from the * JavaScript using the provided name. A JavaScript function with the * provided name will be added to the connector wrapper object (initially * available as this). Calling that JavaScript function will * cause the call method in the registered {@link JavaScriptFunction} to be * invoked with the same arguments. * * @param functionName * the name that should be used for client-side callback * @param function * the {@link JavaScriptFunction} object that will be invoked * when the JavaScript function is called */ protected void addFunction(String functionName, JavaScriptFunction function) { callbackHelper.registerCallback(functionName, function); } /** * Invoke a named function that the connector JavaScript has added to the * JavaScript connector wrapper object. The arguments can be any boxed * primitive type, String, {@link JsonValue} or arrays of any other * supported type. Complex types (e.g. List, Set, Map, Connector or any * JavaBean type) must be explicitly serialized to a {@link JsonValue} * before sending. This can be done either with * {@link JsonCodec#encode(Object, JsonValue, java.lang.reflect.Type, com.vaadin.ui.ConnectorTracker)} * or using the factory methods in {@link Json}. * * @param name * the name of the function * @param arguments * function arguments */ protected void callFunction(String name, Object... arguments) { callbackHelper.invokeCallback(name, arguments); } @Override protected JavaScriptExtensionState getState() { return (JavaScriptExtensionState) super.getState(); } } X-Content-Type-Options: nosniff Content-Security-Policy: default-src 'none' Content-Type: text/plain; charset=UTF-8 Content-Length: 2198 Content-Disposition: inline; filename="ButtonRenderer.java" Last-Modified: Tue, 06 May 2025 06:47:12 GMT Expires: Tue, 06 May 2025 06:52:12 GMT ETag: "73a1fcb140c4a27cf50fc0aad41f05da176376bf" /* * Copyright 2000-2022 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package com.vaadin.v7.ui.renderers; /** * A Renderer that displays a button with a textual caption. The value of the * corresponding property is used as the caption. Click listeners can be added * to the renderer, invoked when any of the rendered buttons is clicked. * * @since 7.4 * @author Vaadin Ltd */ @Deprecated public class ButtonRenderer extends ClickableRenderer { /** * Creates a new button renderer. * * @param nullRepresentation * the textual representation of {@code null} value */ public ButtonRenderer(String nullRepresentation) { super(String.class, nullRepresentation); } /** * Creates a new button renderer and adds the given click listener to it. * * @param listener * the click listener to register * @param nullRepresentation * the textual representation of {@code null} value */ public ButtonRenderer(RendererClickListener listener, String nullRepresentation) { this(nullRepresentation); addClickListener(listener); } /** * Creates a new button renderer. */ public ButtonRenderer() { this(""); } /** * Creates a new button renderer and adds the given click listener to it. * * @param listener * the click listener to register */ public ButtonRenderer(RendererClickListener listener) { this(listener, ""); } @Override public String getNullRepresentation() { return super.getNullRepresentation(); } } X-Content-Type-Options: nosniff Content-Security-Policy: default-src 'none' Content-Type: text/plain; charset=UTF-8 Content-Length: 4604 Content-Disposition: inline; filename="ClickableRenderer.java" Last-Modified: Tue, 06 May 2025 06:47:12 GMT Expires: Tue, 06 May 2025 06:52:12 GMT ETag: "8de4b3acf4234c1793ce2a1377b67504e9157c36" /* * Copyright 2000-2022 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package com.vaadin.v7.ui.renderers; import java.lang.reflect.Method; import com.vaadin.event.ConnectorEventListener; import com.vaadin.event.MouseEvents.ClickEvent; import com.vaadin.shared.MouseEventDetails; import com.vaadin.util.ReflectTools; import com.vaadin.v7.shared.ui.grid.renderers.RendererClickRpc; import com.vaadin.v7.ui.Grid; import com.vaadin.v7.ui.Grid.AbstractRenderer; import com.vaadin.v7.ui.Grid.Column; /** * An abstract superclass for Renderers that render clickable items. Click * listeners can be added to a renderer to be notified when any of the rendered * items is clicked. * * @param * the type presented by the renderer * * @since 7.4 * @author Vaadin Ltd */ @Deprecated public class ClickableRenderer extends AbstractRenderer { /** * An interface for listening to {@link RendererClickEvent renderer click * events}. * * @see ButtonRenderer#addClickListener(RendererClickListener) */ @Deprecated public interface RendererClickListener extends ConnectorEventListener { static final Method CLICK_METHOD = ReflectTools.findMethod( RendererClickListener.class, "click", RendererClickEvent.class); /** * Called when a rendered button is clicked. * * @param event * the event representing the click */ void click(RendererClickEvent event); } /** * An event fired when a button rendered by a ButtonRenderer is clicked. */ @Deprecated public static class RendererClickEvent extends ClickEvent { private Object itemId; private Column column; protected RendererClickEvent(Grid source, Object itemId, Column column, MouseEventDetails mouseEventDetails) { super(source, mouseEventDetails); this.itemId = itemId; this.column = column; } /** * Returns the item ID of the row where the click event originated. * * @return the item ID of the clicked row */ public Object getItemId() { return itemId; } /** * Returns the {@link Column} where the click event originated. * * @return the column of the click event */ public Column getColumn() { return column; } /** * Returns the property ID where the click event originated. * * @return the property ID of the clicked cell */ public Object getPropertyId() { return column.getPropertyId(); } } protected ClickableRenderer(Class presentationType) { this(presentationType, null); } protected ClickableRenderer(Class presentationType, String nullRepresentation) { super(presentationType, nullRepresentation); registerRpc(new RendererClickRpc() { @Override public void click(String rowKey, String columnId, MouseEventDetails mouseDetails) { fireEvent(new RendererClickEvent(getParentGrid(), getItemId(rowKey), getColumn(columnId), mouseDetails)); } }); } /** * Adds a click listener to this button renderer. The listener is invoked * every time one of the buttons rendered by this renderer is clicked. * * @param listener * the click listener to be added */ public void addClickListener(RendererClickListener listener) { addListener(RendererClickEvent.class, listener, RendererClickListener.CLICK_METHOD); } /** * Removes the given click listener from this renderer. * * @param listener * the click listener to be removed */ public void removeClickListener(RendererClickListener listener) { removeListener(RendererClickEvent.class, listener); } } X-Content-Type-Options: nosniff Content-Security-Policy: default-src 'none' Content-Type: text/plain; charset=UTF-8 Content-Length: 7839 Content-Disposition: inline; filename="DateRenderer.java" Last-Modified: Tue, 06 May 2025 06:47:12 GMT Expires: Tue, 06 May 2025 06:52:12 GMT ETag: "015bc04498d9be0e2b8236a02681ceb776580d1e" /* * Copyright 2000-2022 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package com.vaadin.v7.ui.renderers; import java.text.DateFormat; import java.util.Date; import java.util.Locale; import com.vaadin.v7.ui.Grid.AbstractRenderer; import elemental.json.JsonValue; /** * A renderer for presenting date values. * * @since 7.4 * @author Vaadin Ltd */ @Deprecated public class DateRenderer extends AbstractRenderer { private final Locale locale; private final String formatString; private final DateFormat dateFormat; /** * Creates a new date renderer. *

* The renderer is configured to render with the {@link Date#toString()} * representation for the default locale. */ public DateRenderer() { this(Locale.getDefault(), ""); } /** * Creates a new date renderer. *

* The renderer is configured to render with the {@link Date#toString()} * representation for the given locale. * * @param locale * the locale in which to present dates * @throws IllegalArgumentException * if {@code locale} is {@code null} */ public DateRenderer(Locale locale) throws IllegalArgumentException { this("%s", locale, ""); } /** * Creates a new date renderer. *

* The renderer is configured to render with the {@link Date#toString()} * representation for the given locale. * * @param locale * the locale in which to present dates * @param nullRepresentation * the textual representation of {@code null} value * @throws IllegalArgumentException * if {@code locale} is {@code null} */ public DateRenderer(Locale locale, String nullRepresentation) throws IllegalArgumentException { this("%s", locale, nullRepresentation); } /** * Creates a new date renderer. *

* The renderer is configured to render with the given string format, as * displayed in the default locale. * * @param formatString * the format string with which to format the date * @throws IllegalArgumentException * if {@code formatString} is {@code null} * @see Format * String Syntax */ public DateRenderer(String formatString) throws IllegalArgumentException { this(formatString, ""); } /** * Creates a new date renderer. *

* The renderer is configured to render with the given string format, as * displayed in the default locale. * * @param formatString * the format string with which to format the date * @param nullRepresentation * the textual representation of {@code null} value * @throws IllegalArgumentException * if {@code formatString} is {@code null} * @see Format * String Syntax */ public DateRenderer(String formatString, String nullRepresentation) throws IllegalArgumentException { this(formatString, Locale.getDefault(), nullRepresentation); } /** * Creates a new date renderer. *

* The renderer is configured to render with the given string format, as * displayed in the given locale. * * @param formatString * the format string to format the date with * @param locale * the locale to use * @throws IllegalArgumentException * if either argument is {@code null} * @see Format * String Syntax */ public DateRenderer(String formatString, Locale locale) throws IllegalArgumentException { this(formatString, locale, ""); } /** * Creates a new date renderer. *

* The renderer is configured to render with the given string format, as * displayed in the given locale. * * @param formatString * the format string to format the date with * @param locale * the locale to use * @param nullRepresentation * the textual representation of {@code null} value * @throws IllegalArgumentException * if either argument is {@code null} * @see Format * String Syntax */ public DateRenderer(String formatString, Locale locale, String nullRepresentation) throws IllegalArgumentException { super(Date.class, nullRepresentation); if (formatString == null) { throw new IllegalArgumentException("format string may not be null"); } if (locale == null) { throw new IllegalArgumentException("locale may not be null"); } this.locale = locale; this.formatString = formatString; dateFormat = null; } /** * Creates a new date renderer. *

* The renderer is configured to render with he given date format. * * @param dateFormat * the date format to use when rendering dates * @throws IllegalArgumentException * if {@code dateFormat} is {@code null} */ public DateRenderer(DateFormat dateFormat) throws IllegalArgumentException { this(dateFormat, ""); } /** * Creates a new date renderer. *

* The renderer is configured to render with he given date format. * * @param dateFormat * the date format to use when rendering dates * @throws IllegalArgumentException * if {@code dateFormat} is {@code null} */ public DateRenderer(DateFormat dateFormat, String nullRepresentation) throws IllegalArgumentException { super(Date.class, nullRepresentation); if (dateFormat == null) { throw new IllegalArgumentException("date format may not be null"); } locale = null; formatString = null; this.dateFormat = dateFormat; } @Override public String getNullRepresentation() { return super.getNullRepresentation(); } @Override public JsonValue encode(Date value) { String dateString; if (value == null) { dateString = getNullRepresentation(); } else if (dateFormat != null) { dateString = dateFormat.format(value); } else { dateString = String.format(locale, formatString, value); } return encode(dateString, String.class); } @Override public String toString() { final String fieldInfo; if (dateFormat != null) { fieldInfo = "dateFormat: " + dateFormat; } else { fieldInfo = "locale: " + locale + ", formatString: " + formatString; } return String.format("%s [%s]", getClass().getSimpleName(), fieldInfo); } } X-Content-Type-Options: nosniff Content-Security-Policy: default-src 'none' Content-Type: text/plain; charset=UTF-8 Content-Length: 1326 Content-Disposition: inline; filename="HtmlRenderer.java" Last-Modified: Tue, 06 May 2025 06:47:12 GMT Expires: Tue, 06 May 2025 06:52:12 GMT ETag: "7e4413cf2d82631d3bec1a467c0e55350d910b2f" /* * Copyright 2000-2022 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package com.vaadin.v7.ui.renderers; import com.vaadin.v7.ui.Grid.AbstractRenderer; /** * A renderer for presenting HTML content. * * @author Vaadin Ltd * @since 7.4 */ @Deprecated public class HtmlRenderer extends AbstractRenderer { /** * Creates a new HTML renderer. * * @param nullRepresentation * the html representation of {@code null} value */ public HtmlRenderer(String nullRepresentation) { super(String.class, nullRepresentation); } /** * Creates a new HTML renderer. */ public HtmlRenderer() { this(""); } @Override public String getNullRepresentation() { return super.getNullRepresentation(); } } X-Content-Type-Options: nosniff Content-Security-Policy: default-src 'none' Content-Type: text/plain; charset=UTF-8 Content-Length: 2184 Content-Disposition: inline; filename="ImageRenderer.java" Last-Modified: Tue, 06 May 2025 06:47:12 GMT Expires: Tue, 06 May 2025 06:52:12 GMT ETag: "d7627783b0d2a44111699aa0139c43ff120c9258" /* * Copyright 2000-2022 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package com.vaadin.v7.ui.renderers; import com.vaadin.server.ExternalResource; import com.vaadin.server.Resource; import com.vaadin.server.ResourceReference; import com.vaadin.server.ThemeResource; import com.vaadin.shared.communication.URLReference; import elemental.json.JsonValue; /** * A renderer for presenting images. *

* The image for each rendered cell is read from a Resource-typed property in * the data source. Only {@link ExternalResource}s and {@link ThemeResource}s * are currently supported. * * @since 7.4 * @author Vaadin Ltd */ @Deprecated public class ImageRenderer extends ClickableRenderer { /** * Creates a new image renderer. */ public ImageRenderer() { super(Resource.class, null); } /** * Creates a new image renderer and adds the given click listener to it. * * @param listener * the click listener to register */ public ImageRenderer(RendererClickListener listener) { this(); addClickListener(listener); } @Override public JsonValue encode(Resource resource) { if (!(resource == null || resource instanceof ExternalResource || resource instanceof ThemeResource)) { throw new IllegalArgumentException( "ImageRenderer only supports ExternalResource and ThemeResource (" + resource.getClass().getSimpleName() + " given)"); } return encode(ResourceReference.create(resource, this, null), URLReference.class); } } X-Content-Type-Options: nosniff Content-Security-Policy: default-src 'none' Content-Type: text/plain; charset=UTF-8 Content-Length: 6804 Content-Disposition: inline; filename="NumberRenderer.java" Last-Modified: Tue, 06 May 2025 06:47:12 GMT Expires: Tue, 06 May 2025 06:52:12 GMT ETag: "4805d962cfdccebe3db03ab20da97c5c4a61f190" /* * Copyright 2000-2022 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package com.vaadin.v7.ui.renderers; import java.text.NumberFormat; import java.util.Locale; import com.vaadin.v7.ui.Grid.AbstractRenderer; import elemental.json.JsonValue; /** * A renderer for presenting number values. * * @since 7.4 * @author Vaadin Ltd */ @Deprecated public class NumberRenderer extends AbstractRenderer { private final Locale locale; private final NumberFormat numberFormat; private final String formatString; /** * Creates a new number renderer. *

* The renderer is configured to render with the number's natural string * representation in the default locale. */ public NumberRenderer() { this(Locale.getDefault()); } /** * Creates a new number renderer. *

* The renderer is configured to render the number as defined with the given * number format. * * @param numberFormat * the number format with which to display numbers * @throws IllegalArgumentException * if {@code numberFormat} is {@code null} */ public NumberRenderer(NumberFormat numberFormat) { this(numberFormat, ""); } /** * Creates a new number renderer. *

* The renderer is configured to render the number as defined with the given * number format. * * @param numberFormat * the number format with which to display numbers * @param nullRepresentation * the textual representation of {@code null} value * @throws IllegalArgumentException * if {@code numberFormat} is {@code null} */ public NumberRenderer(NumberFormat numberFormat, String nullRepresentation) throws IllegalArgumentException { super(Number.class, nullRepresentation); if (numberFormat == null) { throw new IllegalArgumentException("Number format may not be null"); } locale = null; this.numberFormat = numberFormat; formatString = null; } /** * Creates a new number renderer. *

* The renderer is configured to render with the number's natural string * representation in the given locale. * * @param locale * the locale in which to display numbers * @throws IllegalArgumentException * if {@code locale} is {@code null} */ public NumberRenderer(Locale locale) throws IllegalArgumentException { this("%s", locale); } /** * Creates a new number renderer. *

* The renderer is configured to render with the number's natural string * representation in the given locale. * * @param formatString * the format string with which to format the number * @param locale * the locale in which to display numbers * @throws IllegalArgumentException * if {@code locale} is {@code null} */ public NumberRenderer(String formatString, Locale locale) throws IllegalArgumentException { // This will call #toString() during formatting this(formatString, locale, ""); } /** * Creates a new number renderer. *

* The renderer is configured to render with the given format string in the * default locale. * * @param formatString * the format string with which to format the number * @throws IllegalArgumentException * if {@code formatString} is {@code null} * @see Format * String Syntax */ public NumberRenderer(String formatString) throws IllegalArgumentException { this(formatString, Locale.getDefault(), ""); } /** * Creates a new number renderer. *

* The renderer is configured to render with the given format string in the * given locale. * * @param formatString * the format string with which to format the number * @param locale * the locale in which to present numbers * @throws IllegalArgumentException * if either argument is {@code null} * @see Format * String Syntax */ public NumberRenderer(String formatString, Locale locale, String nullRepresentation) { super(Number.class, nullRepresentation); if (formatString == null) { throw new IllegalArgumentException("Format string may not be null"); } if (locale == null) { throw new IllegalArgumentException("Locale may not be null"); } this.locale = locale; numberFormat = null; this.formatString = formatString; } @Override public JsonValue encode(Number value) { String stringValue; if (value == null) { stringValue = getNullRepresentation(); } else if (formatString != null && locale != null) { stringValue = String.format(locale, formatString, value); } else if (numberFormat != null) { stringValue = numberFormat.format(value); } else { throw new IllegalStateException(String.format("Internal bug: " + "%s is in an illegal state: " + "[locale: %s, numberFormat: %s, formatString: %s]", getClass().getSimpleName(), locale, numberFormat, formatString)); } return encode(stringValue, String.class); } @Override public String toString() { final String fieldInfo; if (numberFormat != null) { fieldInfo = "numberFormat: " + numberFormat; } else { fieldInfo = "locale: " + locale + ", formatString: " + formatString; } return String.format("%s [%s]", getClass().getSimpleName(), fieldInfo); } @Override public String getNullRepresentation() { return super.getNullRepresentation(); } } X-Content-Type-Options: nosniff Content-Security-Policy: default-src 'none' Content-Type: text/plain; charset=UTF-8 Content-Length: 1282 Content-Disposition: inline; filename="ProgressBarRenderer.java" Last-Modified: Tue, 06 May 2025 06:47:12 GMT Expires: Tue, 06 May 2025 06:52:12 GMT ETag: "fc9817b70518e4a4c83b44de50f6d13a15ca716a" /* * Copyright 2000-2022 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package com.vaadin.v7.ui.renderers; import com.vaadin.v7.ui.Grid.AbstractRenderer; import elemental.json.JsonValue; /** * A renderer that represents a double values as a graphical progress bar. * * @author Vaadin Ltd * @since 7.4 */ @Deprecated public class ProgressBarRenderer extends AbstractRenderer { /** * Creates a new text renderer. */ public ProgressBarRenderer() { super(Double.class, null); } @Override public JsonValue encode(Double value) { if (value != null) { value = Math.max(Math.min(value, 1), 0); } else { value = 0d; } return super.encode(value); } } X-Content-Type-Options: nosniff Content-Security-Policy: default-src 'none' Content-Type: text/plain; charset=UTF-8 Content-Length: 2004 Content-Disposition: inline; filename="Renderer.java" Last-Modified: Tue, 06 May 2025 06:47:12 GMT Expires: Tue, 06 May 2025 06:52:12 GMT ETag: "c5aa0db324dd110a72a4b9da1f8398db870bbd2b" /* * Copyright 2000-2022 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package com.vaadin.v7.ui.renderers; import com.vaadin.server.ClientConnector; import com.vaadin.server.Extension; import elemental.json.JsonValue; /** * A ClientConnector for controlling client-side * {@link com.vaadin.client.widget.grid.Renderer Grid renderers}. Renderers * currently extend the Extension interface, but this fact should be regarded as * an implementation detail and subject to change in a future major or minor * Vaadin revision. * * @param * the type this renderer knows how to present * * @since 7.4 * @author Vaadin Ltd */ @Deprecated public interface Renderer extends Extension { /** * Returns the class literal corresponding to the presentation type T. * * @return the class literal of T */ Class getPresentationType(); /** * Encodes the given value into a {@link JsonValue}. * * @param value * the value to encode * @return a JSON representation of the given value */ JsonValue encode(T value); /** * This method is inherited from Extension but should never be called * directly with a Renderer. */ @Override @Deprecated void remove(); /** * This method is inherited from Extension but should never be called * directly with a Renderer. */ @Override @Deprecated void setParent(ClientConnector parent); } X-Content-Type-Options: nosniff Content-Security-Policy: default-src 'none' Content-Type: text/plain; charset=UTF-8 Content-Length: 1349 Content-Disposition: inline; filename="TextRenderer.java" Last-Modified: Tue, 06 May 2025 06:47:12 GMT Expires: Tue, 06 May 2025 06:52:12 GMT ETag: "4fbe0dd162ade25cbc8b589339db534349b174ed" /* * Copyright 2000-2022 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package com.vaadin.v7.ui.renderers; import com.vaadin.v7.ui.Grid.AbstractRenderer; /** * A renderer for presenting simple plain-text string values. * * @since 7.4 * @author Vaadin Ltd */ @Deprecated public class TextRenderer extends AbstractRenderer { /** * Creates a new text renderer. */ public TextRenderer() { this(""); } /** * Creates a new text renderer. * * @param nullRepresentation * the textual representation of {@code null} value */ public TextRenderer(String nullRepresentation) { super(String.class, nullRepresentation); } @Override public String getNullRepresentation() { return super.getNullRepresentation(); } }