I am developing a webkit application for public release, and wondering how to deal with context menus.
The problem is there are items in Safari's default context menu that I don't want to show end users:
Reload
Inspect Element
Possibly others. So, question #1 is: Is it possible to remove items selectively from the default context menu?
Another option is to create my own context menu from scratch, but then comes a host of other problems:
I lose default functionality, for example spell-checking on textareas, or accessibility features.
I lose OSX's system-wide context menu handling behavior, so it will be a less-native UI behavior. I suppose for this I could implement the menu in the native host application.
So the main question is in general, What should I do to preserve default functionality in Safari's context menu, while restricting certain things like "reload", "Inspect Element"?
Couldn't you use the WebUIDelegate protocol method?
- (NSArray *)webView:(WebView *)sender contextMenuItemsForElement:(NSDictionary *)element defaultMenuItems:(NSArray *)defaultMenuItems
You should be able to take the defaultItems, add the ones you want to keep to a new array, and then return said array?
Related
Im looking for an option to limit the scope of every selector to a parent selector.
Am trying to abstract away a lot of the (internal implementation) details of our WebApp for the testers that will actually write the UI tests.
If our application shows a Modal dialog (just a div tag that lies op top of all the other content and prevents interacting with the underlying content), I'd like to restrict all Selectors used in the tests written by testers to be automatically limited to the scope of this Modal Dialog div.
Our new client UI framework uses just divs for Modal Dialogs, while our previous client UI framework used an embedded iframe for each modal dialog. In the iframe scenario, we'd call .switchToIframe(), which would effectively limited all selectors used in tests to this iframe.
Am trying to achieve something similar for the new client framework that uses just divs
I'm not sure you can limit the scope of the DOM like that, but you could build out a Page Object Model (POM) design that would only intelliSense existing locators from their respected repos. This way, if they begin typing a locator and it doesn't pop up, a hint that they aren't in the 'scope' of the modal.
We have implemented checkbox in popover. There we are using checked.bind , but in the view model its not reflecting its value on change of the checkboxes.
Sample Gist Run Provided below:
Gist Run
Thanks in Advance
Programmatically injected HTML needs to be compiled manually
The integration with bootstrap I provided to you earlier cannot do this. The bootstrap plugin assigns the innerHTML property of the popover and it does this outside of aurelia's rendering pipeline. The HTML is therefore not compiled by aurelia, which is why bindings (and other aurelia behaviors) will not work.
The templating framework takes care of this for you automatically as long as you are following conventions (such as custom elements). In any other case you'll need to manually work with the ViewCompiler.
In case you're interested, you can see an example with programmatically generated HTML in this gist. Also see this question if you want to know more about it. I do not recommend it in this scenario however.
Use aurelia-dialog
A tooltip (or popover) is just that: a tip on how to use the tool. It should not need more than some plain markup, text and styling (of course this is subjective to some degree, and some people may disagree)
For collecting user input in-between pages or screens, I'd argue a modal dialog is a better fit because of its property to "pop out" more and to de-emphasize the rest of the screen until the user either proceeds or cancels.
More importantly, by using aurelia-dialog your bindings and behaviors will simply work because, well, it's an aurelia plugin :-)
If a button is optionally shown on a page (or part of page), does it qualify that part to be represented as two different PageObjects, where one PageObject provides methods to interact with the button while other PageObject does not? Or, should it be one page with a method which can throw an exception when the Button is not rendered.
What will be a maintainable solution - because in future releases the button may start appearing in both cases or the functionality may totally change.
In this case
the button may start appearing in both cases or the functionality may totally change
possible solution can be - Transporter design pattern. It's basically - navigation that aggregates reused page objects in one external object. Also centralizes the navigation control in the tested system according to the test requirements. This object encapsulates logic associated with the implementation of navigation within the tested system. Thus the problem of business logic does not interfere with the navigation within the system.
I think that Composite Page Object is acceptable and
maintainable solution
in both cases. Since It will allow you to structure your Page objects in a more “object-oriented” way by separating sub objects that can be reused on different pages and include them into the parent object. Consider this example:
Further reading about GUI automation patterns.
Do you have any idea how to hide the Set Encoding menu in the Edit Menu? I had spend some hard time looking for a way to hide this menu.
I try to dig the plugin.xml in many plugins with no luck to look for this Set Encoding action command.
I can't get the action definition id from plug-in spy that I can use to hide this menu in my developed plugin. I only get the info below:
The active contribution item class:
org.eclipse.ui.texteditor.RetargetTextEditorAction
The contributing plug-in:
org.eclipse.ui.workbench.texteditor (3.5.1.r352_v20100105)
The org.eclipse.ui.edit.text.changeEncoding action is usually added to the Edit menu dynamically by the IEditorActionBarContributor specified for the contriubutorClass attribute of the declared org.eclipse.ui.editors extension point.
E.g. the org.eclipse.ui.DefaultTextEditor gets declared by the org.eclipse.ui.editors plugin itself, and specifies the class TextEditorActionContributor as the contriubutorClass. TextEditorActionContributor does add the ChangeEncoding action like so:
public void init(IActionBars bars) {
super.init(bars);
IMenuManager menuManager= bars.getMenuManager();
IMenuManager editMenu= menuManager.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
if (editMenu != null)
editMenu.add(fChangeEncodingAction);
}}
So to completely remove this action from the Edit menu, you would need to define your own editors by extending org.eclipse.ui.editors and providing you own implementation of IEditorActionBarContributor.
You must edit the perspective, right click on the toolbar in Eclipse and you should get a context menu with the alternative Customize perspective.... Then go to the tab Menu visibility and disable the menu item you want to hide.
I want to navigate from a login screen to the dashboard in my Silverlight OOB app.
I started using Caliburn.Micro but now I'm having doubts seeing as all I can use is the Conductor. Or am I missing something?
Note: I changed constructor to Conductor as originally intended. This is what you get for not proofreading your questions.
There are several ways you could display a login screen, probably the nicest is to initiate it from your ShellViewModel. So, your ShellViewModel would have a dependency on your LoginViewModel, which you could inject as an abstraction (ILoginViewModel), or better still use an abstract factory instead, and inject that into your ShellViewModel constructor.
Either way, once you have an instance of your LoginViewModel in the ShellViewModel, you can display it either as a modal dialog box (in which case use the Caliburn.Micro WindowManager.ShowDialog method - inject this dependency as an IWindowManager abstraction), or display the login view as part of your shell views main content area, in which case your ShellViewModel would be a conductor, and will activate an instance of your LoginViewModel with the ActivateItem method.
Once you have received input from your LoginViewModel, either as a modal dialog or conducted view, you can display your DashboardViewModel as appropriate using the ShellViewModel as a conductor.