本文整理汇总了Java中org.pentaho.ui.xul.swt.SwtXulRunner.initialize方法的典型用法代码示例。如果您正苦于以下问题:Java SwtXulRunner.initialize方法的具体用法?Java SwtXulRunner.initialize怎么用?Java SwtXulRunner.initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.pentaho.ui.xul.swt.SwtXulRunner
的用法示例。
在下文中一共展示了SwtXulRunner.initialize方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initializeXul
import org.pentaho.ui.xul.swt.SwtXulRunner; //导入方法依赖的package包/类
private void initializeXul() throws XulException {
SwtXulLoader loader = new SwtXulLoader();
loader.registerClassLoader(getClass().getClassLoader());
loader.setSettingsManager(XulSpoonSettingsManager.getInstance());
loader.setOuterContext(parentShell);
container = loader.loadXul( xulFile, new XulSpoonResourceBundle(getClassForMessages()));
bf.setDocument(container.getDocumentRoot());
for(XulEventHandler h : getEventHandlers()){
container.addEventHandler(h);
}
runner = new SwtXulRunner();
runner.addContainer(container);
// try and get the dialog
xulDialog = (XulDialog) container.getDocumentRoot().getRootElement();
dialogShell = (Shell) xulDialog.getRootObject();
runner.initialize();
}
示例2: preview
import org.pentaho.ui.xul.swt.SwtXulRunner; //导入方法依赖的package包/类
public void preview() {
try {
AbstractReportDefinition element = processWizardSpecification();
SwtXulLoader theXulLoader = new SwtXulLoader();
theXulLoader.registerClassLoader(getClass().getClassLoader());
theXulLoader.setOuterContext(((XulRoot) document.getRootElement()).getRootObject());
theXulLoader.register("PRPT", "org.pentaho.agilebi.spoon.visualizations.xul.PrptViewerTag");
theXulContainer = theXulLoader.loadXul("org/pentaho/agilebi/spoon/wizard/prptPreview.xul");
theXulContainer.addEventHandler(new PreviewCloseHandler());
SwtXulRunner theRunner = new SwtXulRunner();
theRunner.addContainer(theXulContainer);
theRunner.initialize();
PrptViewerTag thePrptViewerTag = (PrptViewerTag) theXulContainer.getDocumentRoot().getElementById("prptViewer");
thePrptViewerTag.setMasterReport((MasterReport) element);
XulDialog theDialog = (XulDialog) theXulContainer.getDocumentRoot().getElementById("prpt-preview");
theDialog.show();
} catch (Exception e) {
e.printStackTrace();
logger.error("error previewing", e);
}
}
示例3: XulUI
import org.pentaho.ui.xul.swt.SwtXulRunner; //导入方法依赖的package包/类
public XulUI( Shell shell, ModelerWorkspace model) throws ModelerException {
try{
SwtXulLoader loader = new SwtXulLoader();
loader.registerClassLoader(getClass().getClassLoader());
loader.setOuterContext(shell);
container = loader.loadXul("org/pentaho/agilebi/modeler/res/panel.xul", new PDIMessages(ModelerWorkspace.class)); //$NON-NLS-1$
controller = new SpoonModelerController(model);
this.meta = new ModelerEngineMeta(controller);
BindingFactory bf = new SwtBindingFactory();
bf.setDocument(container.getDocumentRoot());
container.addEventHandler(controller);
controller.setBindingFactory(bf);
controller.setWorkspaceHelper(new SpoonModelerWorkspaceHelper());
ModelerUiHelper.configureControllers(container, model, bf, controller, new ColResolverController());
runner = new SwtXulRunner();
runner.addContainer(container);
runner.initialize();
container.loadPerspective("ov1");
} catch(Exception e){
logger.info("error initializing", e);
throw new ModelerException(e);
}
}
示例4: initDialogController
import org.pentaho.ui.xul.swt.SwtXulRunner; //导入方法依赖的package包/类
/**
* Initializes a dialog using the specified xul document and dialog id. If
* an event handler is not provided the dialog class will be added as an
* event handler
* @param xulPath Path to the XUL document
* @param dialogId Id of the dialog to create
* @param eventHandler Optional event handler to register
* @param perspective Optional perspective to load
* @throws XulException
*/
public void initDialogController( String xulPath, String dialogId, XulEventHandler eventHandler, String perspective ) throws XulException {
SwtXulLoader loader = new SwtXulLoader();
loader.registerClassLoader(getClass().getClassLoader());
loader.setSettingsManager(XulSpoonSettingsManager.getInstance());
loader.setOuterContext(shell);
container = loader.loadXul( xulPath );
if( eventHandler != null ) {
container.addEventHandler(eventHandler);
} else {
container.addEventHandler(this);
}
runner = new SwtXulRunner();
runner.addContainer(container);
// try and get the dialog
xulDialog = (XulDialog) container.getDocumentRoot().getRootElement().getElementById( dialogId );
swtDialog = (Composite) container.getDocumentRoot().getRootElement().getElementById( dialogId ).getManagedObject();
runner.initialize();
if( perspective != null ) {
container.loadPerspective( perspective );
}
}
示例5: createVisualizationFromModel
import org.pentaho.ui.xul.swt.SwtXulRunner; //导入方法依赖的package包/类
public void createVisualizationFromModel(ModelerWorkspace model, boolean tempModel) {
Spoon spoon = ((Spoon)SpoonFactory.getInstance());
try {
if(tempModel){
ModelerHelper theHelper = ModelerHelper.getInstance();
model = theHelper.clone(model);
}
SwtXulLoader theXulLoader = new SwtXulLoader();
theXulLoader.registerClassLoader(getClass().getClassLoader());
String theFileName = model.getFileName();
if(theFileName == null) {
theFileName = "models/" + model.getModelName() + ".xmi";
}
// flush the cache before creating an analyzer visualization
flushAnalyzerCache();
AnalyzerVisualizationController theController = new AnalyzerVisualizationController(spoon.tabfolder.getSwtTabset(), this, theFileName, model.getModelName(), null, null);
theController.setModel(model);
XulDomContainer theXulContainer = theXulLoader.loadXul(WEB_VISUALIZATION, new PDIMessages(IVisualization.class));
theXulContainer.addEventHandler(theController);
Composite theMainBox = (Composite) theXulContainer.getDocumentRoot().getElementById("mainVBox").getManagedObject();
SwtXulRunner theRunner = new SwtXulRunner();
theRunner.addContainer(theXulContainer);
theRunner.initialize();
createTabForBrowser(theMainBox, theController, model);
reportName = "Unsaved Report"; //$NON-NLS-1$
String contentId = AgileBiVisualizationPerspective.PERSPECTIVE_ID+"\t"+theController.toString(); //$NON-NLS-1$
// TODO - JD enable this in Spoon 4.4
// Spoon.getInstance().addCaller(callerId, contentId);
} catch (Throwable e) {
throw new RuntimeException(e);
}
}
示例6: open
import org.pentaho.ui.xul.swt.SwtXulRunner; //导入方法依赖的package包/类
public boolean open(Node transNode, String fname, boolean importfile) {
Spoon spoon = ((Spoon)SpoonFactory.getInstance());
try {
File f = new File( fname );
reportName = f.getName();
reportName = reportName.substring(0, reportName.indexOf(".xanalyzer")); //$NON-NLS-1$
FileInputStream in = new FileInputStream( f );
StringBuilder sb = new StringBuilder();
byte b[] = new byte[2048];
int n = in.read(b);
while( n != -1 ) {
sb.append( new String(b, 0, n) );
n = in.read(b);
}
Document doc = DocumentHelper.parseText(sb.toString());
Dom4jXPath xpath = new Dom4jXPath( "//@catalog"); //$NON-NLS-1$
Dom4jXPath xpath2 = new Dom4jXPath( "//@cube"); //$NON-NLS-1$
HashMap map = new HashMap();
map.put( "pho", "http://www.pentaho.com"); //$NON-NLS-1$ //$NON-NLS-2$
xpath.setNamespaceContext( new SimpleNamespaceContext( map));
xpath2.setNamespaceContext( new SimpleNamespaceContext( map));
org.dom4j.Node node = (org.dom4j.Node) xpath.selectSingleNode( doc);
org.dom4j.Node node2 = (org.dom4j.Node) xpath2.selectSingleNode( doc);
String modelFileName = node.getText();
String modelId = node2.getText();
SwtXulLoader theXulLoader = new SwtXulLoader();
theXulLoader.registerClassLoader(getClass().getClassLoader());
AnalyzerVisualizationController theController = new AnalyzerVisualizationController(spoon.tabfolder.getSwtTabset(), this, modelFileName, modelId, f.toString(), f.getName());
theController.setDirty(false);
XulDomContainer theXulContainer = theXulLoader.loadXul(WEB_VISUALIZATION, new PDIMessages(IVisualization.class));
theXulContainer.addEventHandler(theController);
Composite theMainBox = (Composite) theXulContainer.getDocumentRoot().getElementById("mainVBox").getManagedObject(); //$NON-NLS-1$
SwtXulRunner theRunner = new SwtXulRunner();
theRunner.addContainer(theXulContainer);
theRunner.initialize();
ModelerWorkspace model = new ModelerWorkspace(new SpoonModelerWorkspaceHelper(), SpoonModelerWorkspaceHelper.initGeoContext());
XmiParser parser = new XmiParser();
FileInputStream inputStream = new FileInputStream(new File(modelFileName));
Domain domain = parser.parseXmi(inputStream);
inputStream.close();
if(model.getDomain() != null) {
LogicalModel logical = model.getLogicalModel(ModelerPerspective.ANALYSIS);
Object property = logical.getProperty("source_type"); //$NON-NLS-1$
if( property != null ) {
IModelerSource theSource = ModelerSourceFactory.generateSource(property.toString());
theSource.initialize(domain);
model.setModelSource(theSource);
}
}
if (domain.getId() == null) {
domain.setId(modelId);
}
model.setDomain(domain);
model.setModelName(domain.getId());
model.setFileName(modelFileName);
model.setTemporary(false);
theController.setModel(model);
theXulContainer.addEventHandler(theController);
createTabForBrowser(theMainBox, theController, model);
// flush the cache before opening an analyzer visualization
flushAnalyzerCache();
theController.openReport(fname);
String fullPath = f.getAbsolutePath();
spoon.getProperties().addLastFile("Analyzer", fullPath, null, false, null); //$NON-NLS-1$
spoon.addMenuLast();
} catch (Throwable e) {
throw new RuntimeException(e);
} return true;
}
示例7: open
import org.pentaho.ui.xul.swt.SwtXulRunner; //导入方法依赖的package包/类
public boolean open(Node transNode, String fname, boolean importfile) {
try {
if(ClassicEngineBoot.getInstance().isBootDone() == false){
ObjectUtilities.setClassLoader(getClass().getClassLoader());
ObjectUtilities.setClassLoaderSource(ObjectUtilities.CLASS_CONTEXT);
LibLoaderBoot.getInstance().start();
LibFontBoot.getInstance().start();
ClassicEngineBoot.getInstance().start();
}
ResourceManager theResourceManager = new ResourceManager();
theResourceManager.registerDefaults();
File theReportFile = new File(fname);
Resource theResource = theResourceManager.createDirectly(theReportFile, MasterReport.class);
MasterReport masterReport = (MasterReport) theResource.getResource();
XulTabAndPanel tabAndPanel = AgileBiVisualizationPerspective.getInstance().createTab();
AgileBiVisualizationPerspective.getInstance().setNameForTab(tabAndPanel.tab, getPathAndFilename(fname)[1].replace(".prpt", "")); //$NON-NLS-1$ //$NON-NLS-2$
SpoonPerspectiveManager.getInstance().activatePerspective(AgileBiVisualizationPerspective.class);
SwtXulLoader theXulLoader = new SwtXulLoader();
theXulLoader.registerClassLoader(getClass().getClassLoader());
theXulLoader.register("PRPT", "org.pentaho.agilebi.spoon.visualizations.xul.PrptViewerTag"); //$NON-NLS-1$ //$NON-NLS-2$
XulDomContainer theXulContainer = theXulLoader.loadXul("org/pentaho/agilebi/spoon/visualizations/prpt/prptVisualization.xul", new PDIMessages(IVisualization.class)); //$NON-NLS-1$
PRPTMeta meta = new PRPTMeta();
meta.setTab(tabAndPanel.tab);
AgileBiVisualizationPerspective.getInstance().setMetaForTab(tabAndPanel.tab, meta);
PRPTVisualizationController controller = new PRPTVisualizationController(meta, masterReport);
controller.setFileName(fname);
controller.setDirty(false);
PmdDataFactory theDataFactory = (PmdDataFactory) masterReport.getDataFactory();
String theXmiFile = theDataFactory.getXmiFile();
ModelerWorkspace model = new ModelerWorkspace(new SpoonModelerWorkspaceHelper(), SpoonModelerWorkspaceHelper.initGeoContext());
XmiParser parser = new XmiParser();
FileInputStream inputStream = new FileInputStream(new File(theXmiFile));
Domain domain = parser.parseXmi(inputStream);
inputStream.close();
LogicalModel logical = domain.getLogicalModels().get(0);
Object property = logical.getProperty("source_type"); //$NON-NLS-1$
if( property != null ) {
IModelerSource theSource = ModelerSourceFactory.generateSource(property.toString());
theSource.initialize(domain);
model.setModelSource(theSource);
}
model.setDomain(domain);
model.setModelName(domain.getId());
model.setFileName(theXmiFile);
model.setTemporary(false);
controller.setModel(model);
theXulContainer.addEventHandler(controller);
Composite theMainBox = (Composite) theXulContainer.getDocumentRoot().getElementById("mainContainer").getManagedObject(); //$NON-NLS-1$
SwtXulRunner theRunner = new SwtXulRunner();
theRunner.addContainer(theXulContainer);
theRunner.initialize();
theMainBox.setParent((Composite) tabAndPanel.panel.getManagedObject());
((Composite) tabAndPanel.panel.getManagedObject()).layout(true);
AgileBiVisualizationPerspective.getInstance().setSelectedMeta(meta);
return true;
} catch(Exception e){
e.printStackTrace();
}
return false;
}
示例8: createVisualizationFromMasterReport
import org.pentaho.ui.xul.swt.SwtXulRunner; //导入方法依赖的package包/类
public void createVisualizationFromMasterReport(MasterReport rpt, boolean tempModel){
try{
if(ClassicEngineBoot.getInstance().isBootDone() == false){
LibLoaderBoot.getInstance().start();
LibFontBoot.getInstance().start();
ClassicEngineBoot.getInstance().start();
}
XulTabAndPanel tabAndPanel = AgileBiVisualizationPerspective.getInstance().createTab();
AgileBiVisualizationPerspective.getInstance().setNameForTab(tabAndPanel.tab, "Untitled Report"); //$NON-NLS-1$
SpoonPerspectiveManager.getInstance().activatePerspective(AgileBiVisualizationPerspective.class);
SwtXulLoader theXulLoader = new SwtXulLoader();
theXulLoader.registerClassLoader(getClass().getClassLoader());
theXulLoader.register("PRPT", "org.pentaho.agilebi.spoon.visualizations.xul.PrptViewerTag"); //$NON-NLS-1$ //$NON-NLS-2$
XulDomContainer theXulContainer = theXulLoader.loadXul("org/pentaho/agilebi/spoon/visualizations/prpt/prptVisualization.xul", new PDIMessages(IVisualization.class)); //$NON-NLS-1$
Composite theMainBox = (Composite) theXulContainer.getDocumentRoot().getElementById("mainContainer").getManagedObject(); //$NON-NLS-1$
PRPTMeta meta = new PRPTMeta();
AgileBiVisualizationPerspective.getInstance().setMetaForTab(tabAndPanel.tab, meta);
meta.setTab(tabAndPanel.tab);
PRPTVisualizationController controller = new PRPTVisualizationController(meta, rpt);
PmdDataFactory theDataFactory = (PmdDataFactory) rpt.getDataFactory();
String theXmiFile = theDataFactory.getXmiFile();
XmiParser parser = new XmiParser();
FileInputStream inputStream = new FileInputStream(new File(theXmiFile));
Domain domain = parser.parseXmi(inputStream);
inputStream.close();
ModelerWorkspace model = new ModelerWorkspace(new SpoonModelerWorkspaceHelper(), SpoonModelerWorkspaceHelper.initGeoContext());
LogicalModel logical = domain.getLogicalModels().get(0);
Object property = logical.getProperty("source_type"); //$NON-NLS-1$
if( property != null ) {
IModelerSource theSource = ModelerSourceFactory.generateSource(property.toString());
theSource.initialize(domain);
model.setModelSource(theSource);
}
model.setDomain(domain);
model.setModelName(domain.getLogicalModels().get(0).getName(LocalizedString.DEFAULT_LOCALE));
model.setFileName(theXmiFile);
model.setTemporary(tempModel);
controller.setModel(model);
theXulContainer.addEventHandler(controller);
SwtXulRunner theRunner = new SwtXulRunner();
theRunner.addContainer(theXulContainer);
theRunner.initialize();
theMainBox.setParent((Composite) tabAndPanel.panel.getManagedObject());
((Composite) tabAndPanel.panel.getManagedObject()).layout(true);
AgileBiVisualizationPerspective.getInstance().setSelectedMeta(meta);
Spoon.getInstance().enableMenus();
} catch(Exception e){
logger.error("Error creating visualization", e);
}
}