mirror of
https://gitee.com/jmix/cuba.git
synced 2024-12-04 20:28:00 +08:00
PL-8540 Some renderers prevent selection changes
This commit is contained in:
parent
b683a6a4b1
commit
7699a5ed89
@ -16,6 +16,9 @@
|
||||
|
||||
package com.haulmont.cuba.web.toolkit.ui.client.grid;
|
||||
|
||||
import com.google.gwt.dom.client.Element;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.vaadin.client.WidgetUtil;
|
||||
import com.vaadin.client.widgets.Grid;
|
||||
import elemental.json.JsonObject;
|
||||
|
||||
@ -32,4 +35,24 @@ public class CubaGridWidget extends Grid<JsonObject> {
|
||||
// ignore shiftKeyDown until datasources don't support multi-sorting
|
||||
super.sortAfterDelayWithSorter(delay, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isWidgetAllowsClickHandling(Element targetElement) {
|
||||
// by default, clicking on widget renderer prevents row selection
|
||||
// for some widget renderers we want to allow row selection
|
||||
return isClickThroughEnabled(targetElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isEventHandlerShouldHandleEvent(Element targetElement) {
|
||||
// by default, clicking on widget renderer prevents cell focus changing
|
||||
// for some widget renderers we want to allow focus changing
|
||||
return isClickThroughEnabled(targetElement);
|
||||
}
|
||||
|
||||
protected boolean isClickThroughEnabled(Element e) {
|
||||
Widget widget = WidgetUtil.findWidget(e, null);
|
||||
return widget instanceof HasClickSettings &&
|
||||
((HasClickSettings) widget).isClickThroughEnabled();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (c) 2008-2017 Haulmont.
|
||||
*
|
||||
* 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.haulmont.cuba.web.toolkit.ui.client.grid;
|
||||
|
||||
public interface HasClickSettings {
|
||||
boolean isClickThroughEnabled();
|
||||
void setClickThroughEnabled(boolean enabled);
|
||||
|
||||
|
||||
}
|
@ -16,12 +16,22 @@
|
||||
|
||||
package com.haulmont.cuba.web.toolkit.ui.client.renderers;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.Style;
|
||||
import com.google.gwt.user.client.ui.Image;
|
||||
import com.haulmont.cuba.web.toolkit.ui.client.renderers.widgets.image.CubaImageWidget;
|
||||
import com.vaadin.client.renderers.ImageRenderer;
|
||||
import com.vaadin.client.widget.grid.RendererCellReference;
|
||||
|
||||
public class CubaImageRenderer extends ImageRenderer {
|
||||
@Override
|
||||
public CubaImageWidget createWidget() {
|
||||
CubaImageWidget image = GWT.create(CubaImageWidget.class);
|
||||
image.addClickHandler(this);
|
||||
image.setClickThroughEnabled(true);
|
||||
return image;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(RendererCellReference cell, String url, Image image) {
|
||||
super.render(cell, url, image);
|
||||
|
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (c) 2008-2017 Haulmont.
|
||||
*
|
||||
* 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.haulmont.cuba.web.toolkit.ui.client.renderers;
|
||||
|
||||
import com.google.gwt.core.shared.GWT;
|
||||
import com.haulmont.cuba.web.toolkit.ui.client.renderers.widgets.progressbar.CubaProgressBarWidget;
|
||||
import com.vaadin.client.renderers.ProgressBarRenderer;
|
||||
|
||||
public class CubaProgressBarRenderer extends ProgressBarRenderer {
|
||||
|
||||
@Override
|
||||
public CubaProgressBarWidget createWidget() {
|
||||
CubaProgressBarWidget progressBar = GWT.create(CubaProgressBarWidget.class);
|
||||
progressBar.addStyleDependentName("static");
|
||||
progressBar.setClickThroughEnabled(true);
|
||||
return progressBar;
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (c) 2008-2017 Haulmont.
|
||||
*
|
||||
* 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.haulmont.cuba.web.toolkit.ui.client.renderers;
|
||||
|
||||
import com.vaadin.client.connectors.ProgressBarRendererConnector;
|
||||
import com.vaadin.shared.ui.Connect;
|
||||
|
||||
@Connect(com.haulmont.cuba.web.toolkit.ui.renderers.CubaProgressBarRenderer.class)
|
||||
public class CubaProgressBarRendererConnector extends ProgressBarRendererConnector {
|
||||
|
||||
@Override
|
||||
public CubaProgressBarRenderer getRenderer() {
|
||||
return (CubaProgressBarRenderer) super.getRenderer();
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2008-2017 Haulmont.
|
||||
*
|
||||
* 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.haulmont.cuba.web.toolkit.ui.client.renderers.widgets.image;
|
||||
|
||||
import com.google.gwt.user.client.ui.Image;
|
||||
import com.haulmont.cuba.web.toolkit.ui.client.grid.HasClickSettings;
|
||||
|
||||
public class CubaImageWidget extends Image implements HasClickSettings {
|
||||
protected boolean clickThroughEnabled = false;
|
||||
|
||||
@Override
|
||||
public boolean isClickThroughEnabled() {
|
||||
return clickThroughEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setClickThroughEnabled(boolean enabled) {
|
||||
clickThroughEnabled = enabled;
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2008-2017 Haulmont.
|
||||
*
|
||||
* 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.haulmont.cuba.web.toolkit.ui.client.renderers.widgets.progressbar;
|
||||
|
||||
import com.haulmont.cuba.web.toolkit.ui.client.grid.HasClickSettings;
|
||||
import com.vaadin.client.ui.VProgressBar;
|
||||
|
||||
public class CubaProgressBarWidget extends VProgressBar implements HasClickSettings {
|
||||
protected boolean clickThroughEnabled = false;
|
||||
|
||||
@Override
|
||||
public boolean isClickThroughEnabled() {
|
||||
return clickThroughEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setClickThroughEnabled(boolean enabled) {
|
||||
clickThroughEnabled = enabled;
|
||||
}
|
||||
}
|
@ -18,7 +18,7 @@ package com.haulmont.cuba.web.gui.components.renderers;
|
||||
|
||||
import com.haulmont.cuba.gui.components.DataGrid;
|
||||
import com.haulmont.cuba.web.gui.components.WebDataGrid.AbstractRenderer;
|
||||
import com.vaadin.ui.renderers.ProgressBarRenderer;
|
||||
import com.haulmont.cuba.web.toolkit.ui.renderers.CubaProgressBarRenderer;
|
||||
|
||||
/**
|
||||
* A renderer that represents a double values as a graphical progress bar.
|
||||
@ -26,7 +26,7 @@ import com.vaadin.ui.renderers.ProgressBarRenderer;
|
||||
public class WebProgressBarRenderer extends AbstractRenderer<Double> implements DataGrid.ProgressBarRenderer {
|
||||
|
||||
@Override
|
||||
protected ProgressBarRenderer createImplementation() {
|
||||
return new ProgressBarRenderer();
|
||||
protected CubaProgressBarRenderer createImplementation() {
|
||||
return new CubaProgressBarRenderer();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2008-2017 Haulmont.
|
||||
*
|
||||
* 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.haulmont.cuba.web.toolkit.ui.renderers;
|
||||
|
||||
import com.vaadin.ui.renderers.ProgressBarRenderer;
|
||||
|
||||
public class CubaProgressBarRenderer extends ProgressBarRenderer {
|
||||
}
|
Loading…
Reference in New Issue
Block a user