Když je na požadavku víc položek, tak že už se grid nevejde do okna a
přidá se položka, tak grid odroluje na poslední přidávanou položku. Upravena aktualizace dat podle změn UI. closes #158
This commit is contained in:
@@ -165,8 +165,23 @@ public class RequirementItem
|
|||||||
if (obj instanceof RequirementItem)
|
if (obj instanceof RequirementItem)
|
||||||
{
|
{
|
||||||
RequirementItem item = (RequirementItem)obj;
|
RequirementItem item = (RequirementItem)obj;
|
||||||
|
|
||||||
|
int thisId = this.getId();
|
||||||
|
int itemId = item.getId();
|
||||||
|
boolean equalsId = (thisId == itemId);
|
||||||
|
|
||||||
|
if (equalsId && (thisId == 0))
|
||||||
|
{
|
||||||
|
// Při zadávání položek do gridu zatím nové položky nemají
|
||||||
|
// přiřazeno ID, takže se rozlišují podle reference
|
||||||
|
// Při hledání položky v seznamu nebo zjišťování indexu pak
|
||||||
|
// byly veškeré položky s ID = 0 a grid nevybíral aktivní
|
||||||
|
// položku správně, stejně tak nepřekresloval ani scrollbar
|
||||||
|
// a pod.
|
||||||
|
return super.equals(obj);
|
||||||
|
}
|
||||||
|
|
||||||
return (this.getId() == item.getId());
|
return equalsId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ public class RequirementForm extends FormViewModel<Requirement>
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GlobalCommand("insertSelectedItem")
|
@GlobalCommand("insertSelectedItem")
|
||||||
@NotifyChange({ "syncItems", "selItemIndex" })
|
@NotifyChange({ "syncItems", "selItemIndex", "selectedItem" })
|
||||||
public void insertSelectedItem(@BindingParam("selected") RequirementSubject selected, @BindingParam("window") Window window)
|
public void insertSelectedItem(@BindingParam("selected") RequirementSubject selected, @BindingParam("window") Window window)
|
||||||
{
|
{
|
||||||
if (selected != null)
|
if (selected != null)
|
||||||
@@ -198,7 +198,7 @@ public class RequirementForm extends FormViewModel<Requirement>
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Command
|
@Command
|
||||||
@NotifyChange({ "selectedItem", "syncItems" })
|
@NotifyChange({ "selectedItem" })
|
||||||
public void recalculate(@BindingParam("form") SimpleForm form, @BindingParam("changed") String source)
|
public void recalculate(@BindingParam("form") SimpleForm form, @BindingParam("changed") String source)
|
||||||
{
|
{
|
||||||
if (this.selectedItem == null)
|
if (this.selectedItem == null)
|
||||||
@@ -222,7 +222,7 @@ public class RequirementForm extends FormViewModel<Requirement>
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Command
|
@Command
|
||||||
@NotifyChange({ "selectedItem", "syncItems" })
|
@NotifyChange({ "selectedItem" })
|
||||||
public void onChangeGroup()
|
public void onChangeGroup()
|
||||||
{
|
{
|
||||||
// Někdo změnil skupinu materiálu nebo služby
|
// Někdo změnil skupinu materiálu nebo služby
|
||||||
@@ -253,7 +253,7 @@ public class RequirementForm extends FormViewModel<Requirement>
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Command
|
@Command
|
||||||
@NotifyChange({ "selectedItem", "syncItems" })
|
@NotifyChange({ "syncItems", "selectedItem", "selItemIndex" })
|
||||||
public void addNewItem()
|
public void addNewItem()
|
||||||
{
|
{
|
||||||
RequirementItem item = new RequirementItem();
|
RequirementItem item = new RequirementItem();
|
||||||
@@ -268,8 +268,9 @@ public class RequirementForm extends FormViewModel<Requirement>
|
|||||||
item.setDescription("");
|
item.setDescription("");
|
||||||
item.setMunit(new MUnitEmb());
|
item.setMunit(new MUnitEmb());
|
||||||
|
|
||||||
this.setSelectedItem(item);
|
|
||||||
this.getDataBean().addItem(item);
|
this.getDataBean().addItem(item);
|
||||||
this.setSelItemIndex(this.getDataBean().getItems().indexOf(item));
|
|
||||||
|
this.selItemIndex = this.getDataBean().getItems().indexOf(item);
|
||||||
|
this.selectedItem = item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user