use of org.pentaho.ui.xul.XulException in project pentaho-kettle by pentaho.
the class FragmentHandlerTest method testLoadDatabaseOptionsFragmentWithException.
@Test(expected = XulException.class)
public void testLoadDatabaseOptionsFragmentWithException() 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);
when(xulDomContainer.loadFragment(anyString(), any(Object.class))).thenThrow(new XulException());
fragmentHandler.loadDatabaseOptionsFragment(null);
}
use of org.pentaho.ui.xul.XulException in project pentaho-kettle by pentaho.
the class FragmentHandlerTest method testShowMessage.
@Test
public void testShowMessage() throws Exception {
XulMessageBox messageBox = mock(XulMessageBox.class);
when(document.createElement("messagebox")).thenReturn(messageBox);
fragmentHandler.showMessage(null);
// Generate exception, should see a message in standard output
when(document.createElement("messagebox")).thenThrow(new XulException());
fragmentHandler.showMessage("");
}
use of org.pentaho.ui.xul.XulException in project pentaho-kettle by pentaho.
the class AuthProviderController method setNewOverlay.
public void setNewOverlay(AuthProvider provider) throws XulException {
if (provider == null) {
provider = new NoAuthAuthProvider(bf);
}
if (this.activeProvider != null) {
getXulDomContainer().removeOverlay(activeProvider.getOverlay());
}
getXulDomContainer().loadOverlay(provider.getOverlay());
if (model.getSelectedItem() != null) {
AuthProvider current = (AuthProvider) model.getSelectedItem().getItem();
if (current.getOverlay().equalsIgnoreCase(provider.getOverlay())) {
try {
current.bind();
} catch (Exception e) {
log.logError(resourceBundle.getString("error.on_bind"), e);
}
}
}
this.activeProvider = provider;
}
use of org.pentaho.ui.xul.XulException in project pentaho-kettle by pentaho.
the class StarModelerPerspective method onFileClose.
public boolean onFileClose() {
int idx = tabbox.getSelectedIndex();
if (idx == -1 || idx >= tabbox.getTabs().getChildNodes().size()) {
return false;
}
try {
if (onTabClose(idx)) {
XulComponent panel = panels.getChildNodes().get(idx);
XulComponent tab = tabs.getChildNodes().get(idx);
panels.removeChild(panel);
tabs.removeChild(tab);
return true;
}
} catch (XulException e) {
e.printStackTrace();
}
return false;
}
use of org.pentaho.ui.xul.XulException in project pentaho-kettle by pentaho.
the class SpoonPerspectiveManager method unloadPerspective.
private void unloadPerspective(SpoonPerspective per) {
per.setActive(false);
List<XulOverlay> overlays = per.getOverlays();
if (overlays != null) {
for (XulOverlay overlay : overlays) {
try {
domContainer.removeOverlay(overlay.getOverlayUri());
} catch (XulException e) {
log.logError("Error unload perspective", e);
}
}
}
getSpoon().enableMenus();
}
Aggregations