Summary: | Coolbar - delete item behavior problem | ||||||
---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] Platform | Reporter: | Lynne Kues <lynne_kues> | ||||
Component: | SWT | Assignee: | Felipe Heidrich <eclipse.felipe> | ||||
Status: | RESOLVED FIXED | QA Contact: | |||||
Severity: | normal | ||||||
Priority: | P3 | ||||||
Version: | 2.0 | ||||||
Target Milestone: | 2.0.1 | ||||||
Hardware: | PC | ||||||
OS: | Linux | ||||||
Whiteboard: | |||||||
Attachments: |
|
Description
Lynne Kues
2002-08-09 13:32:38 EDT
Created attachment 1824 [details]
test case jar file
To fix this is just a matter of removing the last lines of removeItemFromRow. But, this will cause the emulated coolbar to changed the position of the next item of row when a is removed from the row by disposing of the item (what is ok and will fix the problem) or by dragging it to another row (what is bad but happens on windows). I think it's not a friendly behavior change the position of a item "B" when you are draging a item "A". In short, straithforward fix for this will add to the emulated coolbar a "bad behavior" that does exist on windows, but it can be avoid by passing a flag. My question is: should this behavior be emulated anyway ? I'll discuss it with SN. that's a fix: /** * Remove the item from the row. Adjust the x and width values * appropriately. */ void removeItemFromRow(CoolItem item, int rowIndex) { int index = findItem(item).x; int newLength = items[rowIndex].length - 1; Rectangle itemBounds = item.getBounds(); if (newLength > 0) { CoolItem[] newRow = new CoolItem[newLength]; System.arraycopy(items[rowIndex], 0, newRow, 0, index); System.arraycopy(items[rowIndex], index + 1, newRow, index, newRow.length - index); items[rowIndex] = newRow; } else { CoolItem[][] newRows = new CoolItem[items.length - 1][]; System.arraycopy(items, 0, newRows, 0, rowIndex); System.arraycopy(items, rowIndex + 1, newRows, rowIndex, newRows.length - rowIndex); items = newRows; return; } // if (index == 0) { // CoolItem first = items[rowIndex][0]; // Rectangle bounds = first.getBounds(); // int width = bounds.x + bounds.width; // first.setBounds(0, bounds.y, width, bounds.height); // first.requestedWidth = width; // redraw(bounds.x, bounds.y, CoolItem.MINIMUM_WIDTH, bounds.height, false); // } else { // CoolItem previous = items[rowIndex][index - 1]; // Rectangle bounds = previous.getBounds(); // int width = bounds.width + itemBounds.width; // previous.setBounds(bounds.x, bounds.y, width, bounds.height); // previous.requestedWidth = width; // } } Fixed > 20020812 and in R2.0.1 |