use of org.pentaho.ui.xul.binding.DefaultBindingFactory in project pentaho-kettle by pentaho.
the class RepositoryConfigController method init.
public void init() throws ControllerInitializationException {
bf = new DefaultBindingFactory();
bf.setDocument(this.getXulDomContainer().getDocumentRoot());
try {
// $NON-NLS-1$
messageBox = (XulMessageBox) document.createElement("messagebox");
} catch (Throwable th) {
throw new ControllerInitializationException(th);
}
model = new RepositoryConfigModel();
if (bf != null) {
createBindings();
}
initializeModel();
}
use of org.pentaho.ui.xul.binding.DefaultBindingFactory in project pentaho-kettle by pentaho.
the class SpoonLockController method init.
protected void init() {
try {
if ((Spoon.getInstance().getRepository() != null) && (Spoon.getInstance().getRepository().hasService(IAbsSecurityProvider.class))) {
IAbsSecurityProvider securityService = (IAbsSecurityProvider) Spoon.getInstance().getRepository().getService(IAbsSecurityProvider.class);
setCreateAllowed(allowedActionsContains(securityService, IAbsSecurityProvider.CREATE_CONTENT_ACTION));
}
shell = (((Spoon) SpoonFactory.getInstance()).getShell());
XulDomContainer container = getXulDomContainer();
bindingFactory = new DefaultBindingFactory();
bindingFactory.setDocument(container.getDocumentRoot());
bindingFactory.setBindingType(Type.ONE_WAY);
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
bindingFactory.createBinding(this, "activeMetaUnlocked", "lock-context-locknotes", "disabled");
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
bindingFactory.createBinding(this, "lockingNotAllowed", "lock-context-lock", "disabled");
// Try transformation
if (container.getEventHandlers().containsKey("transgraph")) {
// $NON-NLS-1$
// $NON-NLS-1$
workingMeta = ((TransGraph) container.getEventHandler("transgraph")).getMeta();
} else if (container.getEventHandlers().containsKey("jobgraph")) {
// $NON-NLS-1$
// $NON-NLS-1$
workingMeta = ((JobGraph) container.getEventHandler("jobgraph")).getMeta();
}
RepositoryLock repoLock = fetchRepositoryLock(workingMeta);
if (repoLock != null) {
// $NON-NLS-1$
XulMenuitem lockMenuItem = (XulMenuitem) container.getDocumentRoot().getElementById("lock-context-lock");
lockMenuItem.setSelected(true);
// Permit locking/unlocking if the user owns the lock
if (Spoon.getInstance().getRepository() instanceof PurRepository) {
setLockingAllowed(new UnifiedRepositoryLockService(((PurRepository) Spoon.getInstance().getRepository()).getUnderlyingRepository()).canUnlockFileById(workingMeta.getObjectId()));
} else {
setLockingAllowed(repoLock.getLogin().equalsIgnoreCase(Spoon.getInstance().getRepository().getUserInfo().getLogin()));
}
} else {
setLockingAllowed(true);
}
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
firePropertyChange("activeMetaUnlocked", null, repoLock == null);
} catch (Exception e) {
// $NON-NLS-1$
log.error(BaseMessages.getString(PKG, "LockController.NoLockingSupport"), e);
new ErrorDialog(((Spoon) SpoonFactory.getInstance()).getShell(), BaseMessages.getString(PKG, "Dialog.Error"), e.getMessage(), // $NON-NLS-1$
e);
}
}
use of org.pentaho.ui.xul.binding.DefaultBindingFactory in project pentaho-kettle by pentaho.
the class RevisionController method init.
public void init(Repository repository) throws ControllerInitializationException {
try {
this.repository = repository;
// $NON-NLS-1$
mainController = (MainController) this.getXulDomContainer().getEventHandler("mainController");
// $NON-NLS-1$
browseController = (BrowseController) this.getXulDomContainer().getEventHandler("browseController");
bf = new DefaultBindingFactory();
bf.setDocument(this.getXulDomContainer().getDocumentRoot());
// $NON-NLS-1$
messageBox = (XulMessageBox) document.createElement("messagebox");
createBindings();
} catch (Exception e) {
if (mainController == null || !mainController.handleLostRepository(e)) {
throw new ControllerInitializationException(e);
}
}
}
use of org.pentaho.ui.xul.binding.DefaultBindingFactory in project pentaho-kettle by pentaho.
the class Spoon method init.
public void init(TransMeta ti) {
FormLayout layout = new FormLayout();
layout.marginWidth = 0;
layout.marginHeight = 0;
shell.setLayout(layout);
addFileListener(new TransFileListener());
addFileListener(new JobFileListener());
// INIT Data structure
if (ti != null) {
delegates.trans.addTransformation(ti);
}
// Load settings in the props
loadSettings();
transExecutionConfiguration = new TransExecutionConfiguration();
transExecutionConfiguration.setGatheringMetrics(true);
transPreviewExecutionConfiguration = new TransExecutionConfiguration();
transPreviewExecutionConfiguration.setGatheringMetrics(true);
transDebugExecutionConfiguration = new TransExecutionConfiguration();
transDebugExecutionConfiguration.setGatheringMetrics(true);
jobExecutionConfiguration = new JobExecutionConfiguration();
// Clean out every time we start, auto-loading etc, is not a good idea
// If they are needed that often, set them in the kettle.properties file
//
variables = new RowMetaAndData(new RowMeta());
// props.setLook(shell);
shell.setImage(GUIResource.getInstance().getImageSpoon());
cursor_hourglass = new Cursor(display, SWT.CURSOR_WAIT);
cursor_hand = new Cursor(display, SWT.CURSOR_HAND);
Composite sashComposite = null;
MainSpoonPerspective mainPerspective = null;
try {
KettleXulLoader xulLoader = new KettleXulLoader();
xulLoader.setIconsSize(16, 16);
xulLoader.setOuterContext(shell);
xulLoader.setSettingsManager(XulSpoonSettingsManager.getInstance());
ApplicationWindowLocal.setApplicationWindow(this);
mainSpoonContainer = xulLoader.loadXul(XUL_FILE_MAIN, new XulSpoonResourceBundle());
BindingFactory bf = new DefaultBindingFactory();
bf.setDocument(mainSpoonContainer.getDocumentRoot());
mainSpoonContainer.addEventHandler(this);
/* menuBar = (XulMenubar) */
mainSpoonContainer.getDocumentRoot().getElementById("spoon-menubar");
mainToolbar = (XulToolbar) mainSpoonContainer.getDocumentRoot().getElementById("main-toolbar");
props.setLook((Control) mainToolbar.getManagedObject(), Props.WIDGET_STYLE_TOOLBAR);
/* canvas = (XulVbox) */
mainSpoonContainer.getDocumentRoot().getElementById("trans-job-canvas");
deck = (SwtDeck) mainSpoonContainer.getDocumentRoot().getElementById("canvas-deck");
final Composite tempSashComposite = new Composite(shell, SWT.None);
sashComposite = tempSashComposite;
mainPerspective = new MainSpoonPerspective(tempSashComposite, tabfolder);
if (startupPerspective == null) {
startupPerspective = mainPerspective.getId();
}
SpoonPerspectiveManager.getInstance().setStartupPerspective(startupPerspective);
SpoonPerspectiveManager.getInstance().addPerspective(mainPerspective);
SpoonPluginManager.getInstance().applyPluginsForContainer("spoon", mainSpoonContainer);
SpoonPerspectiveManager.getInstance().setDeck(deck);
SpoonPerspectiveManager.getInstance().setXulDoc(mainSpoonContainer);
SpoonPerspectiveManager.getInstance().initialize();
} catch (Exception e) {
LogChannel.GENERAL.logError("Error initializing transformation", e);
}
// addBar();
// Set the shell size, based upon previous time...
WindowProperty windowProperty = props.getScreen(APP_TITLE);
if (windowProperty != null) {
windowProperty.setShell(shell);
} else {
shell.pack();
// Default = maximized!
shell.setMaximized(true);
}
layout = new FormLayout();
layout.marginWidth = 0;
layout.marginHeight = 0;
GridData data = new GridData();
data.grabExcessHorizontalSpace = true;
data.grabExcessVerticalSpace = true;
data.verticalAlignment = SWT.FILL;
data.horizontalAlignment = SWT.FILL;
sashComposite.setLayoutData(data);
sashComposite.setLayout(layout);
sashform = new SashForm(sashComposite, SWT.HORIZONTAL);
FormData fdSash = new FormData();
fdSash.left = new FormAttachment(0, 0);
// fdSash.top = new FormAttachment((org.eclipse.swt.widgets.ToolBar)
// toolbar.getNativeObject(), 0);
fdSash.top = new FormAttachment(0, 0);
fdSash.bottom = new FormAttachment(100, 0);
fdSash.right = new FormAttachment(100, 0);
sashform.setLayoutData(fdSash);
createPopupMenus();
addTree();
addTabs();
mainPerspective.setTabset(this.tabfolder);
((Composite) deck.getManagedObject()).layout(true, true);
SpoonPluginManager.getInstance().notifyLifecycleListeners(SpoonLifeCycleEvent.STARTUP);
// Add a browser widget
if (props.showWelcomePageOnStartup()) {
showWelcomePage();
}
// Allow data to be copied or moved to the drop target
int operations = DND.DROP_COPY | DND.DROP_DEFAULT;
DropTarget target = new DropTarget(shell, operations);
// Receive data in File format
final FileTransfer fileTransfer = FileTransfer.getInstance();
Transfer[] types = new Transfer[] { fileTransfer };
target.setTransfer(types);
target.addDropListener(new DropTargetListener() {
@Override
public void dragEnter(DropTargetEvent event) {
if (event.detail == DND.DROP_DEFAULT) {
if ((event.operations & DND.DROP_COPY) != 0) {
event.detail = DND.DROP_COPY;
} else {
event.detail = DND.DROP_NONE;
}
}
}
@Override
public void dragOver(DropTargetEvent event) {
event.feedback = DND.FEEDBACK_SELECT | DND.FEEDBACK_SCROLL;
}
@Override
public void dragOperationChanged(DropTargetEvent event) {
if (event.detail == DND.DROP_DEFAULT) {
if ((event.operations & DND.DROP_COPY) != 0) {
event.detail = DND.DROP_COPY;
} else {
event.detail = DND.DROP_NONE;
}
}
}
@Override
public void dragLeave(DropTargetEvent event) {
}
@Override
public void dropAccept(DropTargetEvent event) {
}
@Override
public void drop(DropTargetEvent event) {
if (fileTransfer.isSupportedType(event.currentDataType)) {
String[] files = (String[]) event.data;
for (String file : files) {
openFile(file, false);
}
}
}
});
// listen for steps being added or removed
PluginRegistry.getInstance().addPluginListener(StepPluginType.class, new PluginTypeListener() {
@Override
public void pluginAdded(Object serviceObject) {
// hack to get the tree to reload
previousShowTrans = false;
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
refreshCoreObjects();
}
});
}
@Override
public void pluginRemoved(Object serviceObject) {
// hack to get the tree to reload
previousShowTrans = false;
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
refreshCoreObjects();
}
});
}
@Override
public void pluginChanged(Object serviceObject) {
}
});
}
use of org.pentaho.ui.xul.binding.DefaultBindingFactory in project pentaho-kettle by pentaho.
the class AbsContextMenuController method init.
public void init(Repository repository) throws ControllerInitializationException {
try {
if (repository.hasService(IAbsSecurityProvider.class)) {
service = (IAbsSecurityProvider) repository.getService(IAbsSecurityProvider.class);
bf = new DefaultBindingFactory();
bf.setDocument(this.getXulDomContainer().getDocumentRoot());
if (bf != null) {
createBindings();
}
setAllowed(allowedActionsContains(service, IAbsSecurityProvider.CREATE_CONTENT_ACTION));
}
} catch (KettleException e) {
throw new ControllerInitializationException(e);
}
}
Aggregations