*/
public boolean isRelativeHeight();
- /**
- * Checks if the connector is read only.
- *
- * @deprecated This belongs in AbstractFieldConnector, see #8514
- * @return true
- */
- @Deprecated
- public boolean isReadOnly();
-
/**
* Return true if parent handles caption, false if the paintable handles the
* caption itself.
import com.vaadin.client.connectors.data.HasDataSource;
import com.vaadin.client.data.DataSource;
-import com.vaadin.client.ui.AbstractComponentConnector;
+import com.vaadin.client.ui.AbstractFieldConnector;
import com.vaadin.shared.data.DataCommunicatorConstants;
import com.vaadin.shared.data.selection.SelectionModel;
import com.vaadin.ui.AbstractListing;
* @since 8.0
*/
public abstract class AbstractListingConnector<SELECTIONMODEL extends SelectionModel<?>>
- extends AbstractComponentConnector implements HasDataSource {
+ extends AbstractFieldConnector implements HasDataSource {
private DataSource<JsonObject> dataSource = null;
/**
* Returns the selection model instance used.
- *
+ *
* @return the selection model
*/
public SELECTIONMODEL getSelectionModel() {
/**
* Returns the key of the given data row.
- *
+ *
* @param row
* the row
* @return the row key
/**
* Returns the data of the given data row.
- *
+ *
* @param row
* the row
* @return the row data
/**
* Returns whether the given row is selected.
- *
+ *
* @param row
* the row
* @return {@code true} if the row is selected, {@code false} otherwise
// Set the core 'v' style name for the widget
setWidgetStyleName(StyleConstants.UI_WIDGET, true);
- // should be in AbstractFieldConnector ?
- // add / remove read-only style name
- setWidgetStyleName("v-readonly", isReadOnly());
-
// add / remove error style name
setWidgetStyleNameWithPrefix(primaryStyleName, StyleConstants.ERROR_EXT,
null != state.errorMessage);
getWidget().setStyleName(prefix + styleName, add);
}
- /*
- * (non-Javadoc)
- *
- * @see com.vaadin.client.ComponentConnector#isReadOnly()
- */
- @Override
- @Deprecated
- public boolean isReadOnly() {
- return getState().readOnly;
- }
-
@Override
public LayoutManager getLayoutManager() {
return LayoutManager.get(getConnection());
protected void updateWidgetStyleNames() {
super.updateWidgetStyleNames();
+ // add / remove read-only style name
+ setWidgetStyleName("v-readonly", isReadOnly());
+
// add / remove error style name to Fields
setWidgetStyleNameWithPrefix(getWidget().getStylePrimaryName(),
StyleConstants.REQUIRED_EXT, isRequiredIndicatorVisible());
}
+
+ /**
+ * Checks if the connector is read only.
+ *
+ * @return true
+ */
+ public boolean isReadOnly() {
+ return getState().readOnly;
+ }
}
}
getWidget().fu.setName(getWidget().paintableId + "_file");
- if (!isEnabled() || isReadOnly()) {
+ if (!isEnabled()) {
getWidget().disableUpload();
} else if (!uidl.getBooleanAttribute("state")) {
// Enable the button only if an upload is not in progress
--- /dev/null
+/*
+ * Copyright 2000-2016 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.client;
+
+/**
+ * Legacy ComponentConnector with {@code isReadOnly}.
+ *
+ * @author teemusa
+ *
+ */
+public interface ComponentConnector
+ extends com.vaadin.client.ComponentConnector {
+
+ /**
+ * Checks if the connector is read only.
+ *
+ * @deprecated This belongs in AbstractFieldConnector, see #8514
+ * @return true
+ */
+ @Deprecated
+ public boolean isReadOnly();
+
+}
import com.vaadin.client.ui.AbstractComponentConnector;
import com.vaadin.client.ui.AbstractConnector;
import com.vaadin.shared.communication.ServerRpc;
+import com.vaadin.v7.client.ComponentConnector;
import com.vaadin.v7.shared.AbstractLegacyComponentState;
/**
* @deprecated only used for Vaadin 7 compatiblity components
*/
@Deprecated
-public class AbstractLegacyComponentConnector
- extends AbstractComponentConnector {
+public class AbstractLegacyComponentConnector extends AbstractComponentConnector
+ implements ComponentConnector {
// overridden to be visible to VUpload in the same package. Without making
// it public in VUploadConnector
public AbstractLegacyComponentState getState() {
return (AbstractLegacyComponentState) super.getState();
}
+
+ @Override
+ public boolean isReadOnly() {
+ return getState().readOnly;
+ }
+
+ @Override
+ protected void updateWidgetStyleNames() {
+ super.updateWidgetStyleNames();
+
+ // add / remove read-only style name
+ setWidgetStyleName("v-readonly", isReadOnly());
+ }
}
/*
* Copyright 2000-2016 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
@Connect(Form.class)
public class FormConnector extends AbstractComponentContainerConnector
- implements Paintable, MayScrollChildren {
+ implements Paintable, MayScrollChildren,
+ com.vaadin.v7.client.ComponentConnector {
private final ElementResizeListener footerResizeListener = new ElementResizeListener() {
@Override
@Override
public boolean isReadOnly() {
- return super.isReadOnly() || getState().propertyReadOnly;
+ return getState().readOnly || getState().propertyReadOnly;
}
@Override
import com.vaadin.client.VConsole;
import com.vaadin.client.WidgetUtil;
import com.vaadin.client.communication.StateChangeEvent;
-import com.vaadin.client.ui.AbstractComponentConnector;
import com.vaadin.shared.MouseEventDetails;
import com.vaadin.shared.ui.Connect;
import com.vaadin.shared.ui.MultiSelectMode;
+import com.vaadin.v7.client.ui.AbstractLegacyComponentConnector;
import com.vaadin.v7.client.ui.VTree;
import com.vaadin.v7.client.ui.VTree.TreeNode;
import com.vaadin.v7.shared.ui.tree.TreeConstants;
import com.vaadin.v7.ui.Tree;
@Connect(Tree.class)
-public class TreeConnector extends AbstractComponentConnector
+public class TreeConnector extends AbstractLegacyComponentConnector
implements Paintable {
protected final Map<TreeNode, TooltipInfo> tooltipMap = new HashMap<TreeNode, TooltipInfo>();
public class AbstractLegacyComponentState extends AbstractComponentState {
@NoLayout
public boolean immediate = false;
+ public boolean readOnly = false;
}
* read-only mode or not
*/
protected void setReadOnly(boolean readOnly) {
- if (readOnly != isReadOnly()) {
- getState().readOnly = readOnly;
+ if (getState(false) instanceof AbstractFieldState) {
+ if (readOnly != isReadOnly()) {
+ ((AbstractFieldState) getState()).readOnly = readOnly;
+ }
+ } else {
+ throw new IllegalStateException(
+ "This component does not support the read-only mode, since state is of type "
+ + getStateType().getSimpleName()
+ + " and does not inherit "
+ + AbstractFieldState.class.getSimpleName());
}
}
* @see #setReadOnly(boolean)
*/
protected boolean isReadOnly() {
- return getState(false).readOnly;
+ if (getState(false) instanceof AbstractFieldState) {
+ return ((AbstractFieldState) getState(false)).readOnly;
+ }
+ throw new IllegalStateException(
+ "This component does not support the read-only mode, since state is of type "
+ + getStateType().getSimpleName()
+ + " and does not inherit "
+ + AbstractFieldState.class.getSimpleName());
}
/**
protected boolean isRequiredIndicatorVisible() {
if (getState(false) instanceof AbstractFieldState) {
return ((AbstractFieldState) getState(false)).required;
- } else {
- throw new IllegalStateException(
- "This component does not support the required indicator, since state is of type "
- + getStateType().getSimpleName()
- + " and does not inherit "
- + AbstractFieldState.class.getSimpleName());
}
+ throw new IllegalStateException(
+ "This component does not support the required indicator, since state is of type "
+ + getStateType().getSimpleName()
+ + " and does not inherit "
+ + AbstractFieldState.class.getSimpleName());
}
private static final Logger getLogger() {
public class AbstractComponentState extends SharedState {
public String height = "";
public String width = "";
- public boolean readOnly = false;
@NoLayout
public String description = "";
// Note: for the caption, there is a difference between null and an empty
*/
public boolean required = false;
+ /**
+ * Is the field read-only or not.
+ */
+ public boolean readOnly = false;
+
}