How to deleting a Text from anchorpane in javafx - fxml

I am new to the Java fxml.
I' m using anchor pane and adding 30 text,
Then i want to delete one text out of 30.
I have done it in javafx code , how to do with fxml.

It sounds like you've added 30 TextField or Labels to your AnchorPane. If so, the process to remove one is fairly straightforward. You need to give the AnchorPane and the child that you want to remove fx:id attributes and then in your Controller, create matching declarations for each of them.
Once you've done that, you can remove the TextField or Label from the AnchorPane using the same JavaFX code as before. I assume there is a trigger for removing this field, so that's the right place to remove the Text.
For example:
<AnchorPane id="myAnchor" ...>
<TextField id="myText" ...>
And in your controller:
#FXML AnchorPane myAnchor;
#FXML TextField myText;
...
myAnchor.remove(myText);

Related

Adding “AllowUpload” to the landed code tab in the Bill and adjustment screen

I'm trying to add the ability to upload order lines into landed cost on the bills and adjustment screen via excel or csv. I customized the screen and set AllowUpload to True. enter image description here But i don't know how to use the [PXImport]. Can you guy show me step by step.Ex: what is the BQL and where
to put it. Be specific. Thanks
First determine the name of the DataView bound to the grid. To do that you can hold Ctl-Alt and click on the header of the grid and select Customize. It will open the customization project editor in the Screen section. Click on the top most element of the tree view in the middle to select the grid. Lookup the DataMember property on the property pane on the right side, this is the name of the DataView. While in the project editor, expand the Mode section of the property pane and set AllowUpload property to True.
Now that you know the name of the DataView you need to decorate it with the PXImport attribute. Create a Graph Extension in the code section of the project editor for this screen if you haven't already. In the Graph Extension, for a new DataView that you have created you add [PXImport(typeof(PrimaryDac)] right before the DataView declaration like this:
[PXImport(typeof(APInvoice))]
public PXSelect<MyDAC> MyDataView;
For an existing DataView from the base class you can override it in the same way:
[PXImport(typeof(APInvoice))]
public PXSelect<DAC> BaseDataView;
The Primary DAC can be found in the class declaration of the base graph:
public class APInvoiceEntry : APDataEntryGraph<APInvoiceEntry, APInvoice>, PXImportAttribute.IPXPrepareItems
Reference: Enabling Upload from Excel for the Grid

Prime faces dynamically adding tabs

Is it possible to add dynamic tabs (unrelated tabs) with out reloading the page using prime face.
I want to do some thing like this
http://blog.favrik.com/examples/tabs/
we will have a menu bar, and when a menu is clicked,a dynamic tab to be created.
The tab should load a page(xhtml), the tab should be added with out full page reloading and no dependency on any managed bean (as we are trying to be maximum stateless using mostly request scope)
I have seen example showing adding tabs based on bean data. But in my case each tab are independent (pages)
I have added a sample Image from the current flex application,(trying to migrate it to JSF) on what I am trying to do. Each tab is like a independent screen/xhtml file. No view state saved in server. when a menu item is clicked, a new tab is added with the new screen content. on page reload the tabs will be lost (which we can live with it as we are trying to be stateless)
You might need to flesh out your question more with more detail as to what you'll place in the tab. But try this :
Bind your client side TabView to an instance in the backing bean. On the xhmtl side :
<p:tabView id="myTabPanel" binding="#{myBackingBean.tabView}" />
in the backing bean
TabView tabView = new TabView();
//getter and setter
Implement the snippet below in a method to add a Tab as a child of the TabPanel
TabView tabView = new TabView();
Tab newTab = new Tab(); //Create new Tab
newTab.setTitle("Tab Title"); //Set a basic property
tabView.getChildren().add(newTab); //Add as a child of the TabView
Use primefaces RequestContext to ajax update the view to reflect the new tab
RequestContext context = RequestContext.getCurrentInstance();
context.update("myTabPanel");
Alternatively, like 7SpecialGems pointed out, you could simply just bind your TabView to a backing bean list and simply add a new item to that list, updating the TabView with RequestContext as indicated in 3. above to reflect the changes

WP7 Listbox - How to ensure selected item is visible via Binding

Using MVVM Light I have a listbox databound to a collection of several items.
One of the items is the selected one.
With this code it works perfectly and ViewModel structures are updated correctly:
<Name="listBox1"
ItemsSource="{Binding Path=Models}"
SelectedItem="{Binding Path=csProfile.Model, Mode=TwoWay}">
My problem is that when I enter the page if the selected Item is not in the first items it is not visible and the user does not know what was the previous selection.
How could I force the Listbox to always show the Selected Item?
Possibly via properties or Binding.
M
There's no property you can bind to to set what's visible. Instead call ScrollToVerticalOffset() on the ScrollViewer inside the ListBox.
I think you are looking for the ScrollIntoView method. A similar topic was discussed here:
Automatic Scrolling in a Silverlight List Box
The API reference is here: http://msdn.microsoft.com/en-us/library/system.windows.controls.listbox.scrollintoview(VS.95).aspx
Calling UpdateLayout() before calling ScrollIntoView on the selected item seems to be necessary.

WP7 Listbox Binding: Changing image uri in does not reflect in listbox

I have a view with a list box, bound to am obvervable collection of DisplayItems, which has 'Label', 'DisplayValue' and 'IconUri' properties.
I have a View Model which exposes this observable collection. The List Box is correctly populated first time around.
I then have a button which takes action on the selected item. I need to indicate that action has been taken by changing the image.
I am changing the IconUri of the selected item, and can see the new value present when debugging, but the image doesn't change. I can also change the 'Label' and 'DisplayValue' properties and see the new values correctly there when debugging, but the list doesn't change.
My ViewModel implements INotifyPropertyChanged. My DisplayItem class implements INotifyPropertyChanged. I'm calling RaisePropertyChanged I'm sure in too many places rather than too few.
None of the changes are ever reflected on screen.
I'm using a DataItemTemplate for the generated rows. If I could access the image of the selected row I could change it manually, but I can't even do that.
Any help greatly appreciated. I could actually do with a example of a list box displaying items from a bound observable collection, where one property of the selected item is changed and that change is reflected in the list box.
Thanks in advance
A
You didn't implement INotifyPropertyChanged correctly, or you're using it wrong.

How to insert specific amount of space between listbox item in wp7?

How can I place listbox item separated from each other or leaving some space in between.
I believe if you have a datatemplate, you can just add the following code to the listbox itself: Margin="10" (or any number you like) and that will set a space between each item.
Are you using a template for the listbox items? Are you using databinding and the DataContext or ItemSource properties? I'm sure you can add margins to the items you add to the template to create the space you desire. Check out Nerd Dinner Example for use of a template.

Resources