Search in sources :

Example 1 with XulComponent

use of org.pentaho.ui.xul.XulComponent in project pentaho-kettle by pentaho.

the class DataHandlerTest method setUp.

@Before
public void setUp() throws Exception {
    dataHandler = new DataHandler();
    xulDomContainer = mock(XulDomContainer.class);
    document = mock(Document.class);
    XulComponent rootElement = mock(XulComponent.class);
    when(document.getRootElement()).thenReturn(rootElement);
    // Mock the UI components
    accessBox = mock(XulListbox.class);
    when(document.getElementById("access-type-list")).thenReturn(accessBox);
    connectionBox = mock(XulListbox.class);
    when(document.getElementById("connection-type-list")).thenReturn(connectionBox);
    connectionNameBox = mock(XulTextbox.class);
    when(document.getElementById("connection-name-text")).thenReturn(connectionNameBox);
    dialogDeck = mock(XulDeck.class);
    when(document.getElementById("dialog-panel-deck")).thenReturn(dialogDeck);
    deckOptionsBox = mock(XulListbox.class);
    when(document.getElementById("deck-options-list")).thenReturn(deckOptionsBox);
    hostNameBox = mock(XulTextbox.class);
    when(document.getElementById("server-host-name-text")).thenReturn(hostNameBox);
    databaseNameBox = mock(XulTextbox.class);
    when(document.getElementById("database-name-text")).thenReturn(databaseNameBox);
    portNumberBox = mock(XulTextbox.class);
    when(document.getElementById("port-number-text")).thenReturn(portNumberBox);
    userNameBox = mock(XulTextbox.class);
    when(document.getElementById("username-text")).thenReturn(userNameBox);
    passwordBox = mock(XulTextbox.class);
    when(document.getElementById("password-text")).thenReturn(passwordBox);
    serverInstanceBox = mock(XulTextbox.class);
    when(document.getElementById("instance-text")).thenReturn(serverInstanceBox);
    when(serverInstanceBox.getValue()).thenReturn("instance");
    when(serverInstanceBox.getAttributeValue("shouldDisablePortIfPopulated")).thenReturn("true");
    webappName = mock(XulTextbox.class);
    when(document.getElementById("web-application-name-text")).thenReturn(webappName);
    when(webappName.getValue()).thenReturn("webappName");
    messageBox = mock(XulMessageBox.class);
    when(document.createElement("messagebox")).thenReturn(messageBox);
    when(xulDomContainer.getDocumentRoot()).thenReturn(document);
    generalDatasourceWindow = mock(XulRoot.class);
    when(generalDatasourceWindow.getRootObject()).thenReturn(mock(XulComponent.class));
    when(document.getElementById("general-datasource-window")).thenReturn(generalDatasourceWindow);
    dataHandler.setXulDomContainer(xulDomContainer);
}
Also used : XulMessageBox(org.pentaho.ui.xul.components.XulMessageBox) XulTextbox(org.pentaho.ui.xul.components.XulTextbox) XulDeck(org.pentaho.ui.xul.containers.XulDeck) XulRoot(org.pentaho.ui.xul.containers.XulRoot) XulListbox(org.pentaho.ui.xul.containers.XulListbox) XulDomContainer(org.pentaho.ui.xul.XulDomContainer) Document(org.pentaho.ui.xul.dom.Document) XulComponent(org.pentaho.ui.xul.XulComponent) Before(org.junit.Before)

Example 2 with XulComponent

use of org.pentaho.ui.xul.XulComponent in project pentaho-kettle by pentaho.

the class DataHandler method traverseDomSetReadOnly.

private void traverseDomSetReadOnly(XulComponent component, boolean readonly) {
    component.setDisabled(readonly);
    List<XulComponent> children = component.getChildNodes();
    if (children != null && children.size() > 0) {
        for (XulComponent child : children) {
            child.setDisabled(readonly);
            traverseDomSetReadOnly(child, readonly);
        }
    }
}
Also used : XulComponent(org.pentaho.ui.xul.XulComponent)

Example 3 with XulComponent

use of org.pentaho.ui.xul.XulComponent in project pentaho-kettle by pentaho.

the class FragmentHandlerTest method testLoadDatabaseOptionsFragment.

@Test
public void testLoadDatabaseOptionsFragment() throws Exception {
    XulComponent component = mock(XulComponent.class);
    XulComponent parent = mock(XulComponent.class);
    when(component.getParent()).thenReturn(parent);
    when(document.getElementById("database-options-box")).thenReturn(component);
    XulDomContainer fragmentContainer = mock(XulDomContainer.class);
    Document mockDoc = mock(Document.class);
    XulComponent firstChild = mock(XulComponent.class);
    when(mockDoc.getFirstChild()).thenReturn(firstChild);
    when(fragmentContainer.getDocumentRoot()).thenReturn(mockDoc);
    when(xulDomContainer.loadFragment(anyString(), any(Object.class))).thenReturn(fragmentContainer);
    fragmentHandler.loadDatabaseOptionsFragment(null);
}
Also used : XulDomContainer(org.pentaho.ui.xul.XulDomContainer) Document(org.pentaho.ui.xul.dom.Document) XulComponent(org.pentaho.ui.xul.XulComponent) Test(org.junit.Test)

Example 4 with XulComponent

use of org.pentaho.ui.xul.XulComponent in project pentaho-kettle by pentaho.

the class DataHandler method windowClosed.

private boolean windowClosed() {
    boolean closedWindow = true;
    XulComponent window = document.getElementById("general-datasource-window");
    if (window == null) {
        // window must be root
        window = document.getRootElement();
    }
    if (window instanceof XulWindow) {
        closedWindow = ((XulWindow) window).isClosed();
    }
    return closedWindow;
}
Also used : XulComponent(org.pentaho.ui.xul.XulComponent) XulWindow(org.pentaho.ui.xul.containers.XulWindow)

Example 5 with XulComponent

use of org.pentaho.ui.xul.XulComponent in project pentaho-kettle by pentaho.

the class FragmentHandler method loadDatabaseOptionsFragment.

protected void loadDatabaseOptionsFragment(String fragmentUri) throws XulException {
    XulComponent groupElement = document.getElementById("database-options-box");
    XulComponent parentElement = groupElement.getParent();
    XulDomContainer fragmentContainer;
    try {
        // Get new group box fragment ...
        // This will effectively set up the SWT parent child relationship...
        fragmentContainer = this.xulDomContainer.loadFragment(fragmentUri, Messages.getBundle());
        XulComponent newGroup = fragmentContainer.getDocumentRoot().getFirstChild();
        parentElement.replaceChild(groupElement, newGroup);
    } catch (XulException e) {
        e.printStackTrace();
        throw e;
    }
}
Also used : XulException(org.pentaho.ui.xul.XulException) XulDomContainer(org.pentaho.ui.xul.XulDomContainer) XulComponent(org.pentaho.ui.xul.XulComponent)

Aggregations

XulComponent (org.pentaho.ui.xul.XulComponent)33 XulException (org.pentaho.ui.xul.XulException)13 KettleException (org.pentaho.di.core.exception.KettleException)8 XulConfirmBox (org.pentaho.ui.xul.components.XulConfirmBox)8 ControllerInitializationException (org.pentaho.di.ui.repository.repositoryexplorer.ControllerInitializationException)7 XulDomContainer (org.pentaho.ui.xul.XulDomContainer)6 XulPromptBox (org.pentaho.ui.xul.components.XulPromptBox)6 XulMenuitem (org.pentaho.ui.xul.components.XulMenuitem)4 Document (org.pentaho.ui.xul.dom.Document)4 Test (org.junit.Test)3 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)3 UIRepositoryObject (org.pentaho.di.ui.repository.repositoryexplorer.model.UIRepositoryObject)3 Bindable (org.pentaho.ui.xul.stereotype.Bindable)3 Label (com.google.gwt.user.client.ui.Label)2 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)2 ArrayList (java.util.ArrayList)2 HttpStatus (org.apache.http.HttpStatus)2 IAclObject (org.pentaho.di.ui.repository.pur.repositoryexplorer.IAclObject)2 ILockObject (org.pentaho.di.ui.repository.pur.repositoryexplorer.ILockObject)2 UIObjectCreationException (org.pentaho.di.ui.repository.repositoryexplorer.model.UIObjectCreationException)2