use of org.pentaho.ui.xul.containers.XulVbox in project pentaho-kettle by pentaho.
the class SpoonPerspectiveManager method initialize.
public void initialize() {
XulToolbar mainToolbar = (XulToolbar) domContainer.getDocumentRoot().getElementById("main-toolbar");
SwtDeck deck = (SwtDeck) domContainer.getDocumentRoot().getElementById("canvas-deck");
int y = 0;
int perspectiveIdx = 0;
Class<? extends SpoonPerspective> perClass = null;
List<SpoonPerspective> perspectives = getPerspectives();
if (this.startupPerspective != null) {
for (int i = 0; i < perspectives.size(); i++) {
if (perspectives.get(i).getId().equals(this.startupPerspective)) {
perspectiveIdx = i;
break;
}
}
}
final List<PerspectiveData> perspectiveList = new ArrayList<>();
final ToolBar swtToolbar = (ToolBar) mainToolbar.getManagedObject();
final Shell shell = swtToolbar.getShell();
final ToolItem perspectiveButton = new ToolItem(swtToolbar, SWT.DROP_DOWN, 7);
perspectiveButton.setImage(GUIResource.getInstance().getImage("ui/images/perspective_changer.svg"));
perspectiveButton.setToolTipText(BaseMessages.getString(PKG, "Spoon.Menu.View.Perspectives"));
perspectiveButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
Menu menu = new Menu(shell);
for (final PerspectiveData perspectiveData : perspectiveList) {
MenuItem item = new MenuItem(menu, SWT.CHECK);
if (perspectiveData.isHidden()) {
item.setEnabled(false);
}
if (activePerspective.getId().equals(perspectiveData.getId())) {
item.setSelection(true);
}
item.setText(perspectiveData.getName());
item.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent selectionEvent) {
Spoon.getInstance().loadPerspective(perspectiveData.getId());
swtToolbar.forceFocus();
}
});
}
ToolItem item = (ToolItem) e.widget;
Rectangle rect = item.getBounds();
Point pt = item.getParent().toDisplay(new Point(rect.x, rect.y + rect.height));
menu.setLocation(pt.x, pt.y);
menu.setVisible(true);
}
});
for (final SpoonPerspective per : getPerspectives()) {
if (installedPerspectives.contains(per)) {
y++;
continue;
}
String name = per.getDisplayName(LanguageChoice.getInstance().getDefaultLocale());
PerspectiveData perspectiveData = new PerspectiveData(name, per.getId());
if (Arrays.asList(defaultDisabled).contains(per.getId())) {
perspectiveData.setHidden(true);
}
perspectiveList.add(perspectiveData);
XulVbox box = deck.createVBoxCard();
box.setId("perspective-" + per.getId());
box.setFlex(1);
deck.addChild(box);
PerspectiveManager perspectiveManager = new PerspectiveManager(per, box, mainToolbar, perspectiveList, name);
perspectiveManagerMap.put(per, perspectiveManager);
// Need to force init for main perspective even if it won't be shown
if (perspectiveIdx == y || y == 0) {
if (perspectiveIdx == y) {
// we have a startup perspective. Hold onto the class
perClass = per.getClass();
}
// force init
perspectiveManager.initializeIfNeeded();
}
y++;
installedPerspectives.add(per);
}
deck.setSelectedIndex(perspectiveIdx);
if (perClass != null) {
// activate the startup perspective
try {
activatePerspective(perClass);
// stop other perspectives from opening
SpoonPerspectiveManager.getInstance().setForcePerspective(true);
} catch (KettleException e) {
// TODO Auto-generated catch block
}
}
}
use of org.pentaho.ui.xul.containers.XulVbox in project data-access by pentaho.
the class MultiTableDatasource method activating.
@Override
public void activating() throws XulException {
this.connectionSelectionStep.activating();
this.tablesSelectionStep.activating();
this.joinDefinitionsStep.activating();
XulVbox queryVbox = (XulVbox) document.getElementById("queryBox");
queryVbox.setVisible(false);
XulVbox metadataVbox = (XulVbox) document.getElementById("metadata");
metadataVbox.setVisible(true);
XulVbox connectionsVbox = (XulVbox) document.getElementById("connectionsLbl");
connectionsVbox.setVisible(true);
XulListbox connections = (XulListbox) document.getElementById("connectionList");
connections.setWidth(568);
connections.setHeight(275);
try {
// RPB: BISERVER-9258.
// conditionally hiding the selection of reporting vs reporting+olap in the case where reporting only makes no
// sense.
// bf.createBinding(wizardModel, "reportingOnlyValid", "metadata", "visible").fireSourceChanged();
// Use a binding to keep the radio buttons in sync
bf.setBindingType(Type.BI_DIRECTIONAL);
XulRadio olapRadio = (XulRadio) document.getElementById("reporting_analysis");
bf.createBinding(olapRadio, "checked", joinGuiModel, "doOlap");
bf.setBindingType(Type.ONE_WAY);
XulRadio reportingRadio = (XulRadio) document.getElementById("reporting");
bf.createBinding(wizardModel, "reportingOnlyValid", reportingRadio, "checked").fireSourceChanged();
} catch (Exception e) {
e.printStackTrace();
}
this.errorDialog = (XulDialog) document.getElementById("errorDialog");
this.errorLabel = (XulLabel) document.getElementById("errorLabel");
this.connectionSelectionStep.setValid(true);
this.setConnection(connectionSelectionStep.getConnection());
}
use of org.pentaho.ui.xul.containers.XulVbox in project data-access by pentaho.
the class QueryPhysicalStep method activating.
@Override
public void activating() {
XulVbox queryVbox = (XulVbox) document.getElementById("queryBox");
queryVbox.setVisible(true);
XulVbox metadataVbox = (XulVbox) document.getElementById("metadata");
metadataVbox.setVisible(false);
XulVbox connectionsVbox = (XulVbox) document.getElementById("connectionsLbl");
connectionsVbox.setVisible(false);
XulListbox connections = (XulListbox) document.getElementById("connectionList");
connections.setWidth(180);
connections.setHeight(325);
}
Aggregations