I have problem with modal window. I call this two methods setIsModal(true) and setShowModalMask(true) but why my window isn't modal ?
Here is the Code :
Window summaryWindow = new Window();
summaryWindow.setWidth(950);
summaryWindow.setHeight(620);
summaryWindow.centerInPage();
summaryWindow.setCanDragReposition(false);
summaryWindow.setIsModal(true);
summaryWindow.setShowModalMask(true);
summaryWindow.setShowMinimizeButton(false);
summaryWindow.setTitle("Example");
summaryWindow.addItem(new Button("Example");
summaryWindow.show();
The exception you're getting is valid. In any GWT related technology, you'll find many API functionalities to set properties of GWT widget. For example, for a Window widget you have, setWidth, setHeight, centerInPage etc...
Now some of these properties MUST be applied before the widget is rendered in DOM of the browser & some of them MUST be applied after the widget is rendered in DOM of the browser.
ShowModalMask() is a property that you can set only before the widget is rendered.
centerInPage() is a property that renders Window in DOM of browser & that is the reason you're getting the exception.
Apply properties in a proper order (centerInPage() after ShowModalMask() in your case) to avoid this kind of exception.
I'm using smartgwt 2.4 : if I try your code with a button calling it enclosed in a method I get an error which indicated I cannot modify it with setModalMask (IllegalStateException - this property cannot be changed after the component has been created) .
After moving this call just after the instanciation it's working:
Window summaryWindow = new Window();
summaryWindow.setShowModalMask(true);
I don't really understand, but let me know if it's also working for you
Related
I am using Winium + Java for automation testing of Windows application, and trying to access tool bar menu.
When I tried to detect elements using UI Automation Verify, I couldn't see child elements under tool bar element like below screenshot.
enter image description here
But my tool bar definitely has sub menu items like screenshot and I need to access them.
enter image description here
I tried below java code, but it didn't work
WebElement el = driver.findElement(By.id('59398'));
el.click();
WebElement child = el.findElement(By.name('Start'));
child.click();
when I tried
driver.findElement(By.name"Start').click();
it clicked my windows start menu, not my application's menu.
Is there any way to access items under this tool bar?
You can try use another UI Inspector
eg. UI SPY or Inspector.exe
Probably your ID is not a AutomationID (process id?)
You should find a main window (parent of your app) (Example for calc) and get a parameter like AutomationId, ClassName or Name
I see this is MFC application, and this is an app side MFC library problem. If you hover mouse over toolbar button using Inspect.exe, the info is available but you can't reach this button from the hierarchy (the buttons have no parent somehow). Possible workaround involves combined Win32 API and UI Automation approach:
get button rectangle using Win32 API (but there is no text).
use ElementFromPoint method of UI Automation API and get actual texts to choose the right button.
P.S. My suggestion is applicable for Java + Winium in theory. But I can't estimate the complexity because I'm not a Java expert. So below is Python solution.
We have plans to implemented this mixed way in pywinauto. See issue #413. It contains Python code sample how to do that. We've had no chance to integrate it yet.
from ctypes.wintypes import tagPOINT
import pywinauto
app = pywinauto.Application().start(r'.\apps\MFC_samples\RebarTest.exe')
menu_bar = app.RebarTest.MenuBar.wrapper_object()
point = menu_bar.button(0).rectangle().mid_point()
point = menu_bar.client_to_screen(point)
elem = pywinauto.uia_defines.IUIA().iuia.ElementFromPoint(tagPOINT(point[0], point[1]))
element = pywinauto.uia_element_info.UIAElementInfo(elem)
print(element.name)
I have a netbeans platform application,
The Output window consists of two tabs in which am able to embed one of the tab in to a separate component with the following reference,
http://wiki.netbeans.org/DevFaqOWTabEmbedding
However, when i tried adding actions to it , the actions are not coming up in UI .
IOContainer ioc = IOContainer.create(new IOC());
InputOutput io = IOProvider.getDefault().getIO("test",
new Action[]{
new OneAction(),
new TwoAction(),
new ThreeAction()},ioc);
am expecting the three actions to be shown in the newly created window.
Something like this,
But am getting only the white window.
However, if i don't embed the tab in to another component, the actions appear.
Any help?
IOC has empty implementation of IOContainer.Provider method
setToolbarActions(JComponent comp, Action[] toolbarActions)
you should add JToolbar in IOC and implement that method.
I want to disable moving events from Vaadin Calendar
All of these handlers are automatically set when creating a new Calendar. If you wish to disable some of the default functionality, you can simply set the corresponding handler to null. This will prevent the functionality from ever appearing on the user interface. For example, if you set the EventMoveHandler to null, the user will be unable to move events in the browser. --> Book of Vaadin
I tried:
calendar.setHandler(null);
calendar.setHandler((EventMoveHandler) null);
calendar.setHandler((BaseEventMoveHandler) null);
EventMoveHandler handler = null;
calendar.setHandler(handler);
BaseEventMoveHandler baseHandler = null;
calendar.setHandler(baseHandler );
But nothing is working. Any suggestion....?
It really works for me with Vaadin 7.4.5:
calendar.setHandler((EventMoveHandler)null);
calendar.setHandler((EventResizeHandler)null);
If you want to disable all handlers and make the calendar completely read-only, this worked for me.
calendar.setReadOnly(true);
EDIT1:
This approach however doesn't disable resize pointers for the events. Thus, the best solution I see is to use it together with asmellado's answer :
calendar.setReadOnly(true);
calendar.setHandler((EventMoveHandler)null);
calendar.setHandler((EventResizeHandler)null);
Also, if I did not use the setReadOnly method, I was running in some strage client-side exceptions when I tried to move the event.
I have a problem with my code using zk components.
I am trying to make a popup window without zul file but compose it within my java code.
This is the sample of the code of mine
#Listen("onClick = #btnPopUp")public void popUp(){
Window win = new Window();
win.setId("winPop");
/* i compose some rows, label and other component here...*/
win.doModal();
}
When i click the btnPopUp button, i got an error message ERROR org.zkoss - >> org.zkoss.zk.ui.SuspendNotAllowedException: Not attached, <Window null#winPop>
I got a clue to use Executions.createComponents() method. But is this method can really help? because i usually use this method with a zul file for ex: Window win = (Window) Executions.createComponents("myZul",parent, map);
Thanks guys, really appreciate your help
//Sorry for my bad english :(
‘Not attached‘ is ZK's way of saying the component (the ‘Window‘) doesn't have a parent component.
win.setParent(parent);
or
parent.appendChild(win);
I believe this needs to be done before ‘win.doModal()‘ is called.
I have a RCP applicaton from which I need to show a GEF Editor in a modal "dialog". But since the editor framework seems to be tightly coupled to the use of a workbench window etc I need to find a why to open a new workbench window (with its own WorkbenchWindowAdvisor etc) so that I can open my GEF editor within this workbench window. Once I get this workbenchWindow opened I will set the style of the WorkbenchWindow's shell to be application modal.
I have done this in a customer project using the following components:
A static class with a method openNewWindow(String type, ...). This is the method you call to open a new window. The type argument specifies the wanted type of window.
The class looks up the specified type via a new extension point to get an ILocalWorkbenchWindowAdvisor and the initial perspective ID.
It then saves the information in global variables and calls IWorkbench.openWorkbenchWindow(perspectiveID, ...)
In ApplicationWorkbenchAdvisor.createWorkbenchWindowAdvisor(...) a new advisor is create based on the saved ILocalWorkbenchWindowAdvisor - the returned advisor basically delegates all the postWindowCreate(...), etc to the same methods in ILocalWorkbenchWindowAdvisor...
If no ILocalWorkbenchWindowAdvisor is saved - which is the case for the very first window to be opened - the type "mainWindow" is looked up and used...
It works pretty well and let all parts of the project add new windows as needed.
Use the command "org.eclipse.ui.window.newWindow" to open a new window. In your WorkbenchWindowAdvisor.preWindowOpen(), set the shell style on the IWorkbenchWindowConfigurer to be application modal. You can also hide the coolbar, menu and status bars, so it looks more like a dialog than a window.