use of org.pentaho.ui.xul.XulException in project pentaho-platform by pentaho.
the class MantleXul method xulLoaded.
/**
* Callback method for the MantleXulLoader. This is called when the Xul file has been processed.
*
* @param runner
* GwtXulRunner instance ready for event handlers and initializing.
*/
public void xulLoaded(GwtXulRunner runner) {
// handlers need to be wrapped generically in GWT, create one and pass it our reference.
// instantiate our Model and Controller
controller = new MantleController(new MantleModel(this));
// Add handler to container
container = (GwtXulDomContainer) runner.getXulDomContainers().get(0);
container.addEventHandler(controller);
try {
runner.initialize();
} catch (XulException e) {
// $NON-NLS-1$
Window.alert("Error initializing XUL runner: " + e.getMessage());
e.printStackTrace();
return;
}
// Get the toolbar from the XUL doc
// $NON-NLS-1$
Widget bar = (Widget) container.getDocumentRoot().getElementById("mainToolbarWrapper").getManagedObject();
// $NON-NLS-1$
Widget xultoolbar = (Widget) container.getDocumentRoot().getElementById("mainToolbar").getManagedObject();
xultoolbar.getElement().removeClassName("toolbar");
toolbar.setStylePrimaryName("mainToolbar-Wrapper");
toolbar.setWidget(bar);
// Get the menubar from the XUL doc
// $NON-NLS-1$
Widget menu = (Widget) container.getDocumentRoot().getElementById("mainMenubar").getManagedObject();
menubar.setWidget(menu);
// check based on user permissions
final String moduleBaseURL = GWT.getModuleBaseURL();
final String moduleName = GWT.getModuleName();
final String contextURL = moduleBaseURL.substring(0, moduleBaseURL.lastIndexOf(moduleName));
// $NON-NLS-1$
final String url = contextURL + "api/repo/files/canCreate";
RequestBuilder executableTypesRequestBuilder = new RequestBuilder(RequestBuilder.GET, url);
executableTypesRequestBuilder.setHeader("accept", "text/plain");
executableTypesRequestBuilder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
try {
executableTypesRequestBuilder.sendRequest(null, new RequestCallback() {
public void onError(Request request, Throwable exception) {
// showError(exception);
}
public void onResponseReceived(Request request, Response response) {
if (response.getStatusCode() == Response.SC_OK) {
Boolean visible = new Boolean(response.getText());
controller.setMenuBarEnabled("newmenu", visible);
controller.setToolBarButtonEnabled("newButton", visible);
}
}
});
} catch (RequestException e) {
// showError(e);
}
// get the admin perspective from the XUL doc
// $NON-NLS-1$
Widget admin = (Widget) container.getDocumentRoot().getElementById("adminPerspective").getManagedObject();
admin.setStyleName("admin-perspective");
admin.getElement().getStyle().clearHeight();
admin.getElement().getStyle().clearWidth();
adminPerspective.setWidget(admin);
Panel adminContentPanel = (Panel) container.getDocumentRoot().getElementById("adminContentPanel").getManagedObject();
adminContentPanel.add(adminContentDeck);
adminContentDeck.setHeight("100%");
adminContentDeck.getElement().getStyle().setProperty("height", "100%");
fetchPluginOverlays();
}
use of org.pentaho.ui.xul.XulException in project pentaho-platform by pentaho.
the class MantleXul method removeOverlay.
public void removeOverlay(final String id) {
if (container != null) {
try {
container.removeOverlay(id);
} catch (XulException e) {
// ignored
}
} else {
Timer t = new Timer() {
public void run() {
try {
if (container != null) {
cancel();
container.removeOverlay(id);
}
} catch (XulException e) {
// ignored
}
}
};
t.scheduleRepeating(250);
}
}
use of org.pentaho.ui.xul.XulException in project pentaho-platform by pentaho.
the class MantleXul method applyOverlay.
public void applyOverlay(final String id) {
if (container != null) {
try {
container.loadOverlay(id);
} catch (XulException e) {
// ignored
}
} else {
Timer t = new Timer() {
public void run() {
try {
if (container != null) {
cancel();
container.loadOverlay(id);
}
} catch (XulException e) {
// ignored
}
}
};
t.scheduleRepeating(250);
}
}
use of org.pentaho.ui.xul.XulException in project pdi-dataservice-server-plugin by pentaho.
the class DataServiceRemapConfirmationDialog method open.
void open() throws KettleException {
Document xulDocument;
try {
xulDocument = initXul(parent, new KettleXulLoader(), new SwtXulRunner());
} catch (XulException e) {
throw new KettleException("Failed to create data service remap confirmation dialog", e);
}
((SwtDialog) xulDocument.getElementById(XUL_DIALOG_ID)).show();
}
use of org.pentaho.ui.xul.XulException in project pdi-dataservice-server-plugin by pentaho.
the class DataServiceTestDialog method initXul.
private Document initXul(Composite parent) throws KettleException {
try {
SwtXulLoader swtLoader = new KettleXulLoader();
swtLoader.setOuterContext(parent);
swtLoader.registerClassLoader(getClass().getClassLoader());
XulDomContainer container = swtLoader.loadXul(XUL_PATH, resourceBundle);
container.addEventHandler(dataServiceTestController);
final XulRunner runner = new SwtXulRunner();
runner.addContainer(container);
runner.initialize();
return container.getDocumentRoot();
} catch (XulException xulException) {
throw new KettleException("Failed to initialize DataServicesTestDialog.", xulException);
}
}
Aggregations