Update menu item in Glassware timeline - google-mirror-api

I need to update menu item display name after taping that.I get Timeline item notification and change menu item then change its Display name property and then update time line.but same Menu item there.
var menuItem = item.MenuItems.FirstOrDefault(m => m.Payload.Equals("ONSITE"));
if (menuItem != null)
{
var menuValue = menuItem.Values.FirstOrDefault(v => v.State.Equals("DEFAULT"));
if (menuValue != null)
menuValue.DisplayName = "Confirmed";
}
service.Timeline.Update(item,item.Id).Execute();
}
is this possible? or any method to update menu item data.

Related

Grid with LitTemplate not updating checkbox consistently

We are updating our Grid forms to use LitTemplates for rendering. However we have run into an issue with a checkbox state not being updated even though the underlying data for the state has been updated. The following code demonstrates the issue:
HorizontalLayout hlTest = new HorizontalLayout();
List<String> selected = new ArrayList<>();
Grid<String> testGrid =new Grid<>();
testGrid.setWidth("250px");
testGrid.setHeight("250px");
List<String> dataList = new ArrayList<>(List.of("AAAAA", "BBBBB", "CCCCC", "DDDDD", "EEEEE"));
ListDataProvider<String> dataProvider = new ListDataProvider<>(dataList);
testGrid.setItems(dataProvider);
String template = """
<vaadin-checkbox #click="${handleCheckClick}" ?checked="${item.rowSelected}"></vaadin-checkbox>
<div>${item.text}</div>
""";
LitRenderer<String> lit = LitRenderer.of(template);
lit.withProperty("rowSelected", item -> {
boolean rc = selected.contains(item);
System.out.println("Item selected: " + item + " => " + rc);
return rc;
});
lit.withProperty("text",item -> item);
lit.withFunction("handleCheckClick", (item) -> {
if(selected.contains(item))
selected.remove(item);
else
selected.add(item);
});
testGrid.addColumn(lit);
Button bSelect = new Button("Select");
bSelect.addClickListener(buttonClickEvent -> {
if(selected.size() > 0)
{
dataList.clear();
dataList.addAll(selected);
selected.clear();
dataProvider.refreshAll();
}
});
hlTest.add(testGrid, bSelect);
With the given grid, click a few checkboxes and click 'Select'. The list is reduced to the selected rows, but the checkboxes are still ticked even though 'selected' is empty. The logging within 'rowSelected' is correctly returning the state.
If I remove the column and re-add to grid, then all is displayed correctly. Also, if I select all items in the grid then the select also works correctly.
Currently using Java17 and Vaadin 22.0.6 (have also tried 23.0.0 beta3).
Thanks.
I think you need to call dataProvider refresh when you update
lit.withFunction("handleCheckClick", (item) -> {
if(selected.contains(item))
selected.remove(item);
else
selected.add(item);
testGrid().getDataProvider().refreshAll();
});

ExtJs 6 or 7 focus treelist item into view

I have this treelist with a toolbar that I use to create new elements (it's a document list) and I want to focus the newly created item. I can select it but I don't seem to find a way of focusing it:
const selected = documents.treeStore.getAt(documents.treeStore.findExact(
"documentId", current.id
));
if (selected) {
tree.cmp.setSelection(selected);
const node = tree.cmp.getSelection();// maybe redundant
// how do I focus this node into view?
}
If by focus you mean that the element should appear in the visibility range, you can use this method
ensureVisible
const selected = documents.treeStore.getAt(documents.treeStore.findExact(
"documentId", current.id
));
if (selected) {
var path = [];
do {
path.push(selected.getId());
}while (selected = selected.getRefOwner());
tree.cmp.expandPath('/' + path.reverse().join('/'), {focus:true});
}

How to get the current swipe tabs selected index value in codename one?

I am using codename one swipe tabs dynamically to prepare some radio button but on swiping of tabs getSelectedIndex () method is giving the previous tabs value(previous in the sense suppose I move my tabs from 0 to 1 so it's giving me 0) so how to get the current tab value at which my tab is because on basis of this selectedIndexTab value I want my radio button to get selected.
Here is my code
TableLayout t1=new TableLayout(1, 5);
radioTypeContainer=new Container(t1);
for(i=0;i<5;i++){
t.addTab("Tab2"+i, new SpanLabel("Some text directly in the tab"));
firstTab = new RadioButton[i];
plain = new RadioButton("");
plain.setName("rdb"+i);
rbt =new RadioButton();
rbt.setName("rbt"+i);
radioTypeContainer.add(rbt);
finalRadioList.add(rbt.getName());
finalRadioList.add(t.getTabUIID());
}
borderLayoutContainer.add(BorderLayout.SOUTH,radioTypeContainer);
t.addSelectionListener((i1, i) -> {
Log.p("====***======="+t.getSelectedIndex());
});
Thanks in Advance
newSelected in selectionchanged method gives the current position of tab as shown in below code.
t.addSelectionListener(new SelectionListener() {
#Override
public void selectionChanged(int oldSelected, int newSelected) {
Log.p("====***======="+newSelected);
}
});

How to switch in tabs of popup

enter image [enter image description here]1description here hi when i give details and click on button one popup appears which is having two tabs how to switch between those tabs?
Util.NavigateToLoginPage(ref Driver);
HomeWf.Login(Driver, Username, Password);
var homePage = new PrimaryNavigation(Driver);
homePage.ClickOnMainNavigators(Driver, MainNavigation.Products);
homePage.ClickOnSubMenuOptions(Driver, SubMenuLinks.Products.AddNewProduct);
var bulndlepage = new ProductHomePage(Driver);
bulndlepage.LnkBundleProduct.Click();
//bulndlepage.TxtBrowseNode.SendKeys("Mobile Phones");
bulndlepage.SelectCategory(Driver, "Books"
Console.WriteLine("TxtTitle PRINTED");
bulndlepage.TxtSku.SendKeys("6701");
Console.WriteLine("TxtSku PRINTED");
bulndlepage.ChkCod.Click();
Console.WriteLine("ChkCod PRINTE
bulndlepage.ChkOffline.Click();
Console.WriteLine("ChkOffline PRINTED");
bulndlepage.BtnSaveNext.Click();
bulndlepage.BtnSaveNext.Click();
bulndlepage.BtnAssociateProd.Click();
Driver.SwitchTo().Window(Driver.WindowHandles.Last());
You need to stock your first window name and your popup name.
//Click on your PopUp
driver.FindElement(By.CssSelector("input[id*='IdElemToCLick']")).Click();
string LastWindow = null;
string FirstWindow = null;
foreach (var item in driver.WindowHandles)
{
//Stock first window name
if (FirstWindow == null)
{
FirstWindow = item;
}
LastWindow = item;
}
if (LastWindow != null)
{
// Go to PopUp
driver.SwitchTo().Window(LastWindow);
// Do something with this PopUp
[...]
// Go back to Main Page
driver.SwitchTo().Window(FirstWindow);
}
I see the window appears is a Modal window. You can simply get the id/cssSelector/xpath of the tabs and click on them as required.

Data Grid View Scoll bar issues

I have One Winform.There is one TabContainer inside it in Fill Mode I am adding one another form with group box and DataGridView with dock mode fill as control of tab inside that tab control with dock mode fill.I have set Scroll bar property to both for DataGridView but not able to Show Horizontal.
if (activeForm != null &&
hasReviseAvgDiscountPermission == true)
{
//Add for in tab page.
FrmRePricing reviseAvgDiscount = new FrmRePricing(activeForm, secondaryUser);
if (reviseAvgDiscount.WidgetDataLoaded == true)
{
reviseAvgDiscount.CloseOnEscape = false;
reviseAvgDiscount.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
reviseAvgDiscount.TopLevel = false;
tabPgAvgDiscountRevision.Controls.Add(reviseAvgDiscount);
reviseAvgDiscount.Dock = DockStyle.Fill;
reviseAvgDiscount.Show();
reviseAvgDiscount.Focus();
}
else
{
//Remove tab page if no data found.
tabWidget.TabPages.Remove(tabPgAvgDiscountRevision);
}
this is code to load form as control.and I have data in grid there are show many columns but show intial some columns.

Resources