ADF: Show/hide options in af:navigationPane - jsf

I'm using JDeveloper 11.1.1.7.0
I have followed this tutorial http://docs.oracle.com/cd/E18941_01/tutorials/jdtut_11r2_43/jdtut_11r2_43.html to create a basic and plain left-side menu in my application.
This tutorial shows more advance topics, but I have created a simple left-side menu, with a list.
I haved created an unbounded task flow, drag/drop a wildcard, then the views, then the control flows, ... It works perfect
In the JSF template, in the left-side, I have this code:
<af:navigationPane id="pt_np1" hint="list" value="#{supervision_menu}" var="supervisionInfo">
<f:facet name="nodeStamp">
<af:commandNavigationItem text="#{supervisionInfo.label}" id="pt_cni1"
destination="#{supervisionInfo.destination}"
action="#{supervisionInfo.doAction}"/>
</f:facet>
I need an advanced feature, and I want to show/hide some options, based on a parameter.
I need to execute a view object with this parameter, process the results, so I get the information to know which options could be shown or hidden.
So, my questions are:
How could I force to execute this check as the first step of this flow?
In generated menu.xml and in af:commandNavigationItem, there are visible attribute. Where should I place the condition?
Any help would be very appreciated. Thanks

Not exactly sure what you mean by this:
I need to execute a view object with this parameter.
Assuming you mean "execute a QUERY against the VO", then if you used a ViewCriteria to create the where clause fragment that gets ANDed to the VO where clause, then you can use ExecWithParams (here,here, here) and drag this method onto the task flow as part of the navigation to the View. Then this will execute prior to entry to the view. Or use you can use Invoke on there Executables of the Binding layer - drag to top of list of executables, but this is no longer the recommended way, being replaced with the previous method.
if you are not using ViewCriteria (why not?) then one suggestion is to expose a method on the AM containing the VO, and pass the parms to this method and have it call the VO, but this is basically what ExecWithParms does. This method, once exposed, could be utilized in the same fashion as I mentioned above. If you can describe more precisely what you are trying to do I can try to be of more help.

As I told to Joe, the final solution requires to change the approach.
I have made an unbounded task flow, then created a menu, then adding ADF Security and finally shown/hidden options, in function of user roles/permissions.
I hope it helps. Thank you

Related

How can I activate (display) a view using Revit API?

I am trying to activate a view using Revit API. What I want to do exactly is to prompt the user to select some walls, but when the user is asked that, he can't switch views to select more walls (everything is greyed out at that point).
So the view I want to activate (by that I mean, I want this view to be actually shown on screen) already exist, and I can access its Id.
I have seen threads about creating, browsing, filtering views, but nothing on activating it... It's a Floor Plan view.
So far I can access its associated ViewPlan object, and associated parameters (name, Id, ..).
Is it possible to do ?
Thanks a lot !
Arnaud.
I think the most preferred way is the UIDocument.RequestViewChange() method. The tricky part about this is that unless you've designed your application to be modeless with external events or idling, it may not actually happen until later when control returns back to Revit from your addin.
(There's also setting the UIDocument.ActiveView property - not positive if this has different constraints).
The other way that I have done it historically is through the use of the UIDocument.ShowElements() command. The trick here is that you don't have control of the exact view - but if you can figure out the elements that appear only in that view, you can generally make it happen (even if you have to do a separate query to get a bunch of elements that are only in the given floorplan view).
Good Luck!
I think the solution to your problem may be:
commandData.Application.ActiveUIDocument.ActiveView = View;
The ActiveView is a property and it has {get and set} options.
ActiveView has only a get accessor, what Mostafa suggests will not work.
I have used the RequestViewChange() method with a modal dialog and have not had problems so far.

Is there a design pattern for validation?

Is there any adequate design pattern that should be used in order to do number of validations?
For example, let's say that I have an application containing a toolbar with icons, each representing a picture on my file system. I am dragging an icon on a document. Validations during the drag and drop operation could be:
check if the file exists in file system
check if the user has access rights to drag the icon
check that the document is open in order to drop the picture on it
and so on...
I thought of using the Chain of Responsibility or Decorator patterns.
Thanks!
Actually, what you're after, or rather what I'd suggest, is Continuation Passing Style. It's not so much a design pattern as a way of writing code where validation would be defined as a pipeline of methods that an object would go through. This pipeline would use an accumulator to collect all the validation problems encountered by the code.

UML Activity Diagram for android project

I have created the below diagram and I wanted to know if the diagram that I have done is correct.
The below diagram is based on an android application. When the application loads the user is given 3 button to select add, update and help. On click on add button the user is given an option to add a new user or add a new item. When he select either of the options he enters the required data once the data is entered the system check if all the values are entered correctly and then finally saved. The same process is applied for update.
Your diagram misses an entry point. Though it's rather obvious that the top action is the start, only the entry point is the one indicating the beginning.
You can omit most of the diamonds and directly transfer via a guard from actions. So your conditions should be guards and written as [Yes] or [No]. The top most action (and quite some others) is(/are) indeed what should be written inside (or aside) the diamond below.
An excerpt for an update could look like this:
Finally Values added does not look like an action but rather as state. It should be omitted. Alternatively use differently named end flows.
So far for the formal points. But as #eyp said: it's a good one and one can understand what you tried to express. The above is just for the picky teachers.
It's a good one but it lacks some detail in the diamonds. You should write besides the diamon the question before choosing the next setp to do.
For example in the diamond after Check update value you may write is valid? or another question that clarifies more the business logic.

Is there a best practice for enable (CanExecute) a button in an other userControl?

Is there a best practice for how to enable (CanExecute) a button in an other userControl?
A simple scenario is as follow.
When selecting one row in a datagrid in UserControl_1 a button should be enabled in UserControl_2 and also provide the selected row to UserControl_2's viewModel.
When the user then push the button in UserControl_2 it will be executed with the data from the selected row from UserControl_1.
Thanks from a Catel newbie.
If you are using WPF (assuming you are), the CanExecute will be triggered by the WPF system (CommandManager to be precise). Catel should automatically requery the commands when a property changes.
If the logic (or at least the data) for the CanExecute should be shared among several user controls (and I am talking about the view models for the several user controls), I recommend to create a service which is registered in the ServiceLocator. In the CanExecute of the commands you can query the same data (the service) and return true or false according to the logic you want to implement.
You may take a look at this post. And you 'll have a good idea about your problem. I don't post the code here since it is an answer of someone else. Please refer the link.
http://social.msdn.microsoft.com/Forums/vstudio/en-US/198c4a4b-b4c2-4dfc-b99b-afb2a11eb4c3/call-button-even-from-user-control-to-another-user-control

Need syntax to call a refresh on one component from another on the page

I have a fairly straightforward and common use case. A panel, in which resides a repeat control. The repeat control gets its content from a view lookup by key. Below that repeat control is another panel. This panel has a data binding to a new notesdocument. The panel has a couple of fields on it for the new document and a submit button.
It all works, however after submit (presumably in the "postSaveDocument()" event) I want to call back up to the repeat control and have it re-perform its lookup and refresh its content.
I'm looking to understand syntactically, how I can reference the repeat control and its properties and methods from elsewhere on the document -- and secondarily (though I can look this up once I get the first part figured out) what the refresh() method would be for that that repeat control.
Ideally, I think its something like: xp:page.repeatcontrolname.refresh() -- though I know that isn't right.
I'm sure once I see an example, it will apply to a myriad of other things.
Update :
I discovered that the repeated elements were actually refreshing but I wasn't seeing a new entry added to the list. The reason, ultimately, turned out to be that to add another entry to the repeat list I needed a new "control" -- but I'd checked that box (on the repeat control) that said "Create Controls at Page Creation". It was preventing my XPage from creating another entry for the new document to display!
This article explains the syntax for doing what you describe:
http://avatar.red-pill.mobi/tim/blog.nsf/d6plinks/TTRY-84B6VP
I have a feeling that this one captures the actual use case.
http://www-10.lotus.com/ldd/ddwiki.nsf/dx/Create_and_display_responses
The key setting that people tend to miss is "ignoreRequestParams".
Andrew,
The 'XSP.PartialRefreshGet' call was broken in Domino release 8.5.3 which results in the '_c9 is undefined' error.
Have a look at the article posted by Tommy Valand:
http://dontpanic82.blogspot.com.au/2012/03/patch-for-bug-in-xsppartialrefreshget.html
Basically to work around the problem a second argument is required to be passed to the call, for example:
XSP.partialRefreshGet("#{id:ExistingDevicesList}", "")

Resources