Ace Datatable row selector with paginator - icefaces

I am using ace datatable with pagination. Now, in a page after selecting some rows, when I go to another page and come back, the selection disappears. Rows are not selected anymore.
Here is the code:
<ace:dataTable var="device" value="#{reportBean.searchTableList}"
id="MeterTable" rows="10" paginator="true"
paginatorPosition="bottom" page="1" selectionMode="multiple"
stateMap="#{reportBean.rowStateMap}" pageCount="4"
rowStyleClass="oddRow1,evenRow1">
<ace:column id="column3" headerText="Meter Name"
sortBy="#{device.device_name}" filterBy="#{device.device_name}"
selected="true"
filterMatchMode="contains" styleClass="dataTableHeader">
<ice:outputText value=" #{device.device_name}" />
</ace:column>
</ace:dataTable>

Seems like your reportBean is RequestScoped.
this means when you browse to the page with the table the reportBean is loaded and when you do a selection the selection values are stored in reportBean.rowStateMap. when browsing to another page the reportBean and the selection information get deleted because it is not the same request (Request Scoped!). when you browse to the table page again, a new reportBean is created which doesn't has any information about the selection
You can try changing your reportBean to SessionScoped but that has other impacts which you should consider.

Related

react-leaflet-draw - onEditStart/Stop events cumulates when trying to edit multiple featureGroups

I have a React application where a react-leaflet#2.7.0 + react-leaflet-draw#0.19.0 map is displaying multiple FeatureGroup components containing polygons.
On the right end side of the app is a clickable list of the feature groups names.
The groups can be selectively "activated" by clicking the names, so if a feature group is active, the EditControl therein is rendered. Only one group can be active at a time.
My problem
when I switch from one group to another and then click the edit button in EditControl, the onEditStart/Stop events of the previously active group still fire, along with the new ones. The more I switch between groups, the more events are fired.
Update:
The issue seems to be that EditControl is never unmounted, even if upon the parent state change it doesn't get rendered. If I add a random key prop to it, the issue is resolved, but then other issues occur.
I don't yet have a minimal code example to share, but to give you an idea of the implementation here is a schema:
<App>
<Map>
<MapContent id="foo">
<FeatureGroup>
<EditControl />
</FeatureGroup>
</MapContent>
<MapContent id="bar">
<FeatureGroup>
<EditControl />
</FeatureGroup>
</MapContent>
</Map>
<GroupSelector />
</App>
Except App (root component), MapContent (very basic wrapper: checks if the group is active) and GroupSelector (clickable list), all other components are from react-leaflet and react-leaflet-draw.
Flow
On click, GroupSelector updates the state of App to set an activeGroupID (i.e. "foo") and MapContent will render its EditControl only if its id matches the activeGroupID
I hope this description makes sense. Any help would be greatly appreciated!

SAPUI5 - How to change the table in the same View?

situation:
2 diferent tables, 1 view;
want to achieve:
I've got to change the table when I change the selectedKey in a select.
I already tried to create fragments with each table and call the one I want when I change the select.
fragment1 - table 1
fragment2 - table 2
select - oEvent (onChangeSelect) - getSelectedKey - if(key === 1) - call fragment1, if(key === 2) - call fragment2, but it gives me an error.
I don't know if this is correct and I'm not finding any infos related online.
If someone can show some links or give me just an idea on how can I do this, it would be perfect.
You could use the concept of binding to achieve this without coding. assume you have something like that in your view:
<Select><!-- ... --></Select>
<core:Fragment ... /><!-- table 1 -->
<core:Fragment ... /><!-- table 2 -->
First, add a model to your app, which will contain the information about the status of the app (which of the fragments is visible currently). Easiest way is to start with an empty JSON model. If you are familiar with manifest.json config, add it there. if not, you could add this in your Components init method:
this.setModel(new JSONModel(), "config");
This way, the new empty model is available under the name "config" in all the views of the app.
Now, we will add a visibility flag, which will control the visibility of your fragments (tables), and can be changed by the select:
<Select selectedKey="{config>/selectedFragmentKey}">
<core:Item key="" text="Please choose one" />
<core:Item key="showFragment1" text="Show Fragment 1" />
<core:Item key="showFragment2" text="Show Fragment 2" />
</Select>
This new version will store the key of the selected item in the config model in the path /selectedFragment. Add visibility flag to fragments (tables):
<!-- table 1 is only visible if "Show Fragment 1" was selected -->
<Table visible="{= ${config>/selectedFragmentKey} === 'showFragment1'}" .../>
<!-- table 2 is only visible if "Show Fragment 2" was selected -->
<Table visible="{= ${config>/selectedFragmentKey} === 'showFragment2'}" .../>
and you're done.
Main lesson here: learn to use bindings.
If I understood the question correctly, you have a selection control (which has 2 entries), and a table in the view. Based on the selection item, you want to display ONE of the tables at any given point of time. I am also assuming here, that the tables are purely used in the current view only & not really a "re-useable" thing - which gets used in different places of the app (which then renders the use of fragments an overkill).
I am assuming, both tables are bound (although to different data sets).
In that case, consider using the "visible" property of the appropriate table to "false".
Remember - all UI components, including tables inherit from sap.ui.core.Control - which has the "visible" property.
In API reference for table : https://sapui5.hana.ondemand.com/#/api/sap.ui.table.Table%23methods/Summary
If you scroll down to "Borrowed from:" section, you will see the "setVisible" and "getVisibe" methods.
So, in the event fired during selection change, you can grab the table control & set the visibility using the aforementioned methods.
Alternatively, you can also set an expression binding directly on the table control in XML, which evaluates to "true" or "false" (perhaps using a formatter).
Let me know if you need further info on this.
Best Regards,
Gopal Nair.

How do I fetch the UID of a page that's been selected with flux:wizard.link?

I'm using the flux:wizard.link to select a page from the page tree in Typo3:
<flux:field.input name="page_id" label="Select page">
<flux:wizard.link activeTab="page"/>
</flux:field.input>
Now, I want to fetch this page and render it in a container.
<v:content.render pageUid="{page_id}" />
But the {page_id} has the t3-link saved instead of the expected pageUID (e.g. t3://page?uid=125)
How do I extract the page's UID?
I could let the user enter just the page-id in an input-field, but I'd rather have her select the page via wizard...
One solution could be to cut the string into two parts:
<v:iterator.explode content="{page_id}" glue="uid=" as="newarray">
{newarray.1}
</v:iterator.explode>
The string page_id is cut at the phrase 'uid=' into two parts, which are saved in the array newarray. With {newarray.1} you can output the second part of the array.
This is most likely not the best solution. It depends on the link which should have always the same structure (containing 'uid=xxx'). But so far it seems to be the only way.

How to Refresh adf table after insert a new row

Hello I have two pages: the first is "creer dossier.jsf" where I can add a new row and the seconde page is "listdossier.jsf" inside it i have a read only table that contains the records of the first page.
when I create a record in the first page it persist in the database but can't appears in the table only when i redploy the application .
I want to get the newest records without redeploying the application..can someone help me please??
to create the table i just drag it from the data control.
I am using EclipseLink JPA as ORM and web logic
I tried to delete the cache using from the persistanc.xml and em.refresh() and always the same problem
here's my table:
<af:table value="#{bindings.dossierFindAllParDepartementDBTE.collectionModel}"
var="row" rows="#{bindings.dossierFindAllParDepartementDBTE.rangeSize}"
emptyText="#{bindings.dossierFindAllParDepartementDBTE.viewable ? 'No data to display.' : 'Access Denied.'}"rowBandingInterval="0"
fetchSize="#{bindings.dossierFindAllParDepartementDBTE.rangeSize}" id="t2"
partialTriggers="l1" width="796px"
immediate="false" binding="#{backingBeanScope.BeanDatabase.t2}">
<af:column headerText="ID_Dossier" id="c5" width="150"
inlineStyle="background-color:#b5ffde">
<af:link actionListener="#{bindings.setCurrentRowWithKeyValue.execute}"
text="#{row.idDossier}"
disabled="#{!bindings.setCurrentRowWithKeyValue.enabled}" id="l1"action="GoEditDossierBTEDEP1" inlineStyle="background-color:#b5ffde"/>
</af:column>
<af:column headerText="Client" id="c6" width="150"
inlineStyle="background-color:#b5ffde">
<af:outputText value="#{row.client}"
shortDesc="#{bindings.dossierFindAllParDepartementDBTE.hints.client.tooltip}"
id="ot6"/>
</af:column>
<af:column headerText="Ingénieur" id="c7" width="150"
inlineStyle="background-color:#b5ffde" headerClass="skin1.css">
<af:outputText value="#{row.ingAff}"shortDesc="#{bindings.dossierFindAllParDepartementDBTE.hints.ingAff.tooltip}"id="ot7"/>
</af:column>
<af:column headerText="Probléme" id="c8" width="300" inlineStyle="background-color:#b5ffde">
<af:outputText value="#{row.descriProb}"
shortDesc={bindings.dossierFindAllParDepartementDBTE.hints.descriProb.tooltip}"
id="ot8"/>
</af:column>
</af:table>
In the task flow that navigates between the two pages, stick a method activity that does a call to the query and re-execute it before you go back to the first page.
You can do that in 2 ways:
Refresh the Page or the Particular component of second page on Submit of the first page.
Refresh the Iterator and VO after submitting the values in the first page

White/UI Automation doesn't recognize the container (pane control) in tab

I'm automating the windows application. I tried to access the pane element(which has text box, combo box controls) under tab control, but it's not accessible. White returns null.
I tried other techniques like UI automation TreeWalker (Rawview, Control view, content view), but nothing helps.
refer images in below links:
https://dl.dropboxusercontent.com/u/68446125/Tab.png
https://dl.dropboxusercontent.com/u/68446125/General%20Pane.png
As in picture 1, tab control is retrieved properly by White/UI Automation, but the child element General* Pane is not returned and it's controls are not accessible (Refer pic 2 highlighted), the first accessible child element is "General* tab Item".
Strange thing is, these controls are accessible in Inspect.exe (in windows SDK). I tried following methods to retrieve controls, but General* Pane is never accessible through White/UI Automation.
var tab = Window.Get<Tab>(SearchCriteria.ByControlType(ControlType.Tab).AndByClassName("TwoPageControl")); // Tab control is retrieved properly
var pane = tab.GetElement(SearchCriteria.ByControlType(ControlType.Pane).AndByText("General*")); // this line returns NULL
var pane1 = revWindow.GetElement(SearchCriteria.ByControlType(ControlType.Pane).AndByText("General*")); // this line returns NULL
var pane2 = revWindow.Get<Panel>(SearchCriteria.ByControlType(ControlType.Pane).AndByText("General*"));// throws exception "Failed to get ControlType=pane,Name=General*,ControlType=pane"
Tried windows UI automation code as well, but no luck.
System.Windows.Automation.Condition cd1 = new AndCondition(
new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Tab),
new PropertyCondition(AutomationElement.ClassNameProperty, "TwoPageControl"));
AutomationElement a = window.FindFirst(TreeScope.Descendants, cd1); // Tab control is returned properly here
TreeWalker rawViewWalker = TreeWalker.RawViewWalker;
AutomationElement cc = rawViewWalker.GetFirstChild(a); // General * Pane is not returned, instead General* Tab item is returned, though it's not the first child.
var cd = rawViewWalker.GetNextSibling(cc); // this returns next pane element available, not General * Pane.
Please help me how to access General * Pane and it's children under tab control. Any help is much appreciated.
I had exactly the same problem with my application. I use Inspect and open source UIAVerify where Pane element was visible as children of tab element. But when i compile Verify as a .Net 4.5 project, Pane element was not seen as part of tab. It only appears when I pointed it directly. I also search for my Pane element in Descendants of main window but there was nothing. I think it has something to do with dynamically creation of that pane content (i mean there is different content when you choose different tabItem).
I think you can't get access to that element from tree point of view.
My solution was to use AutomationElement.FromPoint Method.
http://msdn.microsoft.com/en-us/library/system.windows.automation.automationelement.frompoint(v=vs.110).aspx
I also think this shoud help if you have conntact with people developing program.
Some controls on a page are not visible for MS UI Automation
You can break up the TabControl to just the TabPanel, but without its ContentPresenter. You create your own ContentPresenter which used the content of the selected TabItem.
This way, White will be able to discover the controls in the ContentPresenter.
This is a workaround and it is a shame you have to change your WPF code just because "something goes wrong with UIA". But this is the best I could do.
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TabControl x:Name="uiTab" Grid.Row="1">
<TabControl.Template>
<ControlTemplate TargetType="TabControl">
<TabPanel IsItemsHost="True" VerticalAlignment="Stretch"/>
</ControlTemplate>
</TabControl.Template>
<TabItem Header="first">
<Button>FIRST</Button>
</TabItem>
<TabItem Header="second">
<Button>SECOND</Button>
</TabItem>
</TabControl>
<ContentPresenter Content="{Binding SelectedItem.Content, ElementName=uiTab}"/>
</Grid>