PL-8224 Table headers are shifted when Windows "Scale factor" is 125%

This commit is contained in:
Yuriy Artamonov 2016-11-23 17:48:04 +04:00
parent c9bb092d3e
commit 8073eb5781
3 changed files with 72 additions and 0 deletions

View File

@ -300,6 +300,16 @@ public class CubaGroupTableWidget extends CubaScrollTableWidget {
return super.handleNavigation(keycode, ctrl, shift);
}
@Override
protected boolean isGenericRow(Widget rowWidget) {
return super.isGenericRow(rowWidget) && !(rowWidget instanceof CubaGroupTableBody.CubaGroupTableGroupRow);
}
@Override
protected boolean isCustomColumn(int colIndex) {
return GROUP_DIVIDER_COLUMN_KEY.equals(getColKeyByIndex(colIndex));
}
public CubaGroupTableBody.CubaGroupTableGroupRow getRenderedGroupRowByKey(String key) {
if (scrollBody != null) {
final Iterator<Widget> it = scrollBody.iterator();

View File

@ -42,6 +42,7 @@ import com.vaadin.client.ui.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Set;
import static com.haulmont.cuba.web.toolkit.ui.client.Tools.isAnyModifierKeyPressed;
@ -238,6 +239,36 @@ public class CubaScrollTableWidget extends VScrollTable implements ShortcutActio
}
}
@Override
protected void reassignHeaderCellWidth(int colIndex, HeaderCell hcell, int minWidth) {
if (isCustomColumn(colIndex)) {
return;
}
for (Widget rowWidget : ((CubaScrollTableBody) scrollBody).getRenderedRows()) {
if (isGenericRow(rowWidget)) {
VScrollTableBody.VScrollTableRow row = (VScrollTableBody.VScrollTableRow) rowWidget;
double realColWidth = row.getRealCellWidth(colIndex);
if (realColWidth > 0) {
if (realColWidth > minWidth) {
hcell.setWidth(realColWidth + "px");
}
break;
}
}
}
}
protected boolean isCustomColumn(int colIndex) {
return false;
}
protected boolean isGenericRow(Widget rowWidget) {
return rowWidget instanceof VScrollTableBody.VScrollTableRow;
}
@Override
public int getAdditionalRowsHeight() {
if (aggregationRow != null) {
@ -867,6 +898,10 @@ public class CubaScrollTableWidget extends VScrollTable implements ShortcutActio
profilerMarker = ScreenClientProfiler.getInstance().getProfilerMarker();
super.renderInitialRows(rowData, firstIndex, rows);
}
public LinkedList<Widget> getRenderedRows() {
return renderedRows;
}
}
public void requestFocus(final String itemKey, final String columnKey) {

View File

@ -43,6 +43,7 @@ import com.vaadin.client.ui.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Set;
import static com.haulmont.cuba.web.toolkit.ui.client.Tools.isAnyModifierKeyPressed;
@ -372,6 +373,28 @@ public class CubaTreeTableWidget extends VTreeTable implements ShortcutActionHan
return rowRequestHandler;
}
@Override
protected void reassignHeaderCellWidth(int colIndex, HeaderCell hcell, int minWidth) {
for (Widget rowWidget : ((CubaTreeTableWidget.CubaTreeTableBody) scrollBody).getRenderedRows()) {
if (isGenericRow(rowWidget)) {
VScrollTableBody.VScrollTableRow row = (VScrollTableBody.VScrollTableRow) rowWidget;
double realColWidth = row.getRealCellWidth(colIndex);
if (realColWidth > 0) {
if (realColWidth > minWidth) {
hcell.setWidth(realColWidth + "px");
}
break;
}
}
}
}
protected boolean isGenericRow(Widget rowWidget) {
return rowWidget instanceof VScrollTableBody.VScrollTableRow;
}
protected class CubaTreeTableTableHead extends TableHead {
protected final SimplePanel presentationsEditIcon = GWT.create(SimplePanel.class);
@ -826,6 +849,10 @@ public class CubaTreeTableWidget extends VTreeTable implements ShortcutActionHan
profilerMarker = ScreenClientProfiler.getInstance().getProfilerMarker();
super.renderInitialRows(rowData, firstIndex, rows);
}
public LinkedList<Widget> getRenderedRows() {
return renderedRows;
}
}
protected void showContextMenuPopup(int left, int top) {