My filter editor must look like an in cell editor (when I click on a cell - only one editor for this cell is shown). In future I want to have a different kind of filters. But now I try to write a custom input text filter. It must have an appearance like on this picture:
http://apache-pivot-users.399431.n3.nabble.com/file/n3322554/table.jpg But I have this: http://apache-pivot-users.399431.n3.nabble.com/file/n3322554/teable2..png As you can see there is a free space between my editor an header of table view... How can I remove this and make my filter editor looking like on the first page? My custom editor is GridViewFilterEditor.class... As example I user TableViewRowEditor.class. My code is: public class GridViewFilterEditor extends Window implements GridViewFilter.FilterEditor { private int columnIndex = -1; private CardPane cardPane = new CardPane(); private TablePane tablePane = new TablePane(); private TablePane.Row editorRow = new TablePane.Row(); private static final int IMAGE_CARD_INDEX = 0; public GridViewFilterEditor() { setContent(cardPane); cardPane.add(tablePane); cardPane.getCardPaneListeners().add(new CardPaneListener.Adapter() { @Override public void selectedIndexChanged(CardPane cardPane, int previousSelectedIndex) { if (previousSelectedIndex == IMAGE_CARD_INDEX) { editorRow.get(columnIndex).requestFocus(); } else { endEdit(false); } } }); tablePane.getStyles().put("horizontalSpacing", 1); tablePane.getRows().add(editorRow); } @Override public void beginEdit(GridViewFilter gridViewFilter, int columnIndex) { // Open the editor System.out.println("begin edit. Column index " + columnIndex); this.columnIndex = columnIndex; TableView tableView = gridViewFilter.getTableView(); GridViewFilter.Filter filter = gridViewFilter.getFilters().get(columnIndex); // Add/create the editor components TablePane.ColumnSequence tablePaneColumns = tablePane.getColumns(); // Add a new column to the table pane to match the table view column TablePane.Column tablePaneColumn = new TablePane.Column(); tablePaneColumn.setWidth(tableView.getColumnBounds(columnIndex).width); tablePaneColumns.add(tablePaneColumn); String columnName = filter.getColumnName(); // Default to a read-only text input editor TextInput editorTextInput = new TextInput(); editorTextInput.setTextKey(columnName); editorTextInput.setEnabled(true); editorTextInput.setTextBindType(BindType.LOAD); editorTextInput.setText(filter.getFilterData()); // Add the editor component to the table pane editorRow.add(editorTextInput); // Get the row bounds Bounds filterBounds = gridViewFilter.getFilterBounds(columnIndex); // Scroll to make the row as visible as possible gridViewFilter.scrollAreaToVisible(filterBounds.x, filterBounds.y, filterBounds.width, filterBounds.height); // Constrain the bounds by what is visible through viewport ancestors filterBounds = gridViewFilter.getVisibleArea(filterBounds); Point location = gridViewFilter.mapPointToAncestor( tableView.getDisplay(), filterBounds.x, filterBounds.y); // Set size and location and match scroll left setPreferredWidth(filterBounds.width); setLocation(location.x, location.y + (filterBounds.height - getPreferredHeight(-1)) / 2); // Open the editor open(tableView.getWindow()); } @Override public void endEdit(boolean result) { // TODO Auto-generated method stub } @Override public boolean isEditing() { // TODO Auto-generated method stub return false; } @Override public void open(Display display, Window owner) { super.open(display, owner); // display.getContainerMouseListeners().add(displayMouseHandler); } @Override public void close() { Display display = getDisplay(); // display.getContainerMouseListeners().remove(displayMouseHandler); super.close(); } } When I try to do this System.out.println(filterBounds.x+" "+ filterBounds.y+" "+ filterBounds.width+" "+ filterBounds.height); // Constrain the bounds by what is visible through viewport ancestors filterBounds = gridViewFilter.getVisibleArea(filterBounds); System.out.println(filterBounds.x+" "+ filterBounds.y+" "+ filterBounds.width+" "+ filterBounds.height); In console I see 0 0 180 21 0 21 180 0 May be this line make this free space filterBounds = gridViewFilter.getVisibleArea(filterBounds);? And how to resolve this problem? All my code http://perdunov.net/pivotforum.rar here ----- Thank you! -- View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Custom-TableViewFilter-tp3304078p3322554.html Sent from the Apache Pivot - Users mailing list archive at Nabble.com.
