public BusinessModelDialog( final Shell parent, final int style, final ConceptUtilityInterface conceptUtil, final SchemaMeta schemaMeta) { super(parent); this.conceptModel = new ConceptModel(conceptUtil.getConcept()); this.conceptUtil = conceptUtil; this.schemaMeta = schemaMeta; Locales locales = schemaMeta.getLocales(); activeLocale = schemaMeta.getLocales().getActiveLocale(); propertyEditorContext.put("locales", locales); this.schemaMeta = schemaMeta; }
public void loadOrdersModel() { CWM cwm = null; try { cwm = CWM.getInstance("Orders", true); // $NON-NLS-1$ assertNotNull("CWM singleton instance is null", cwm); cwm.importFromXMI("samples/orders.xmi"); // $NON-NLS-1$ } catch (Exception e) { e.printStackTrace(); fail(); } cwmSchemaFactory = new CwmSchemaFactory(); SchemaMeta schemaMeta = cwmSchemaFactory.getSchemaMeta(cwm); ordersModel = schemaMeta.findModel("Orders"); // $NON-NLS-1$ }
public LogicalModel getOrdersModel() { if (ordersModel == null) { if (USE_LEGACY_CWM) { CWM cwm = null; try { cwm = CWM.getInstance("Orders", true); // $NON-NLS-1$ Assert.assertNotNull("CWM singleton instance is null", cwm); cwm.importFromXMI("samples/orders.xmi"); // $NON-NLS-1$ } catch (Exception e) { e.printStackTrace(); Assert.fail(); } CwmSchemaFactory cwmSchemaFactory = new CwmSchemaFactory(); SchemaMeta schemaMeta = cwmSchemaFactory.getSchemaMeta(cwm); org.pentaho.pms.schema.BusinessModel oldOrdersModel = schemaMeta.findModel("Orders"); // $NON-NLS-1$ try { Domain domain = ThinModelConverter.convertFromLegacy(schemaMeta); ordersModel = domain.findLogicalModel("Orders"); // $NON-NLS-1$ Assert.assertNotNull(ordersModel); } catch (Exception e) { e.printStackTrace(); } // convert to and then from thin model just for giggles } else { try { Domain domain = new XmiParser().parseXmi(new FileInputStream("samples/orders.xmi")); ordersModel = domain.findLogicalModel("Orders"); } catch (Exception e) { e.printStackTrace(); } } } return ordersModel; }
protected final Control createDialogArea(final Composite parent) { Composite c0 = (Composite) super.createDialogArea(parent); Composite container = new Composite(c0, SWT.NONE); container.setLayout(new FormLayout()); GridData gdContainer = new GridData(GridData.FILL_BOTH); container.setLayoutData(gdContainer); Control top = createTop(container); FormData fdTop = new FormData(); fdTop.left = new FormAttachment(0, 0); fdTop.top = new FormAttachment(0, 0); fdTop.right = new FormAttachment(100, 0); top.setLayoutData(fdTop); Composite conceptEditor = new Composite(container, SWT.NONE); conceptEditor.setLayout(new FillLayout()); Group group = new Group(conceptEditor, SWT.SHADOW_OUT); group.setText("Properties"); group.setLayout(new FillLayout()); SashForm s0 = new SashForm(group, SWT.HORIZONTAL); s0.SASH_WIDTH = 10; PropertyNavigationWidget propertyNavigationWidget = new PropertyNavigationWidget(s0, SWT.NONE); propertyNavigationWidget.setConceptModel(conceptModel); propertyWidgetManager = new PropertyWidgetManager2( s0, SWT.NONE, propertyEditorContext, schemaMeta.getSecurityReference()); propertyWidgetManager.setConceptModel(conceptModel); propertyNavigationWidget.addSelectionChangedListener(propertyWidgetManager); s0.setWeights(new int[] {1, 2}); FormData fdConcept = new FormData(); fdConcept.left = new FormAttachment(0, 0); fdConcept.top = new FormAttachment(top, 10); fdConcept.right = new FormAttachment(100, 0); fdConcept.bottom = new FormAttachment(100, 0); conceptEditor.setLayoutData(fdConcept); return c0; }
protected Control createTop(final Composite parent) { Composite c0 = new Composite(parent, SWT.NONE); c0.setLayout(new FormLayout()); Label wlId = new Label(c0, SWT.RIGHT); wlId.setText(Messages.getString("PhysicalTableDialog.USER_NAME_ID")); // $NON-NLS-1$ wId = new Text(c0, SWT.SINGLE | SWT.LEFT | SWT.BORDER); FormData fdlId = new FormData(); fdlId.left = new FormAttachment(0, 0); fdlId.top = new FormAttachment(wId, 0, SWT.CENTER); wlId.setLayoutData(fdlId); Label conLabel = new Label(c0, SWT.RIGHT); conLabel.setText("Connection:"); conField = new Combo(c0, SWT.BORDER | SWT.READ_ONLY | SWT.V_SCROLL | SWT.H_SCROLL); comboViewer = new ComboViewer(conField); comboViewer.setContentProvider( new IStructuredContentProvider() { public Object[] getElements(final Object inputElement) { List ul = (List) inputElement; return ul.toArray(); } public void dispose() { if (logger.isDebugEnabled()) { logger.debug("Disposing ..."); } } public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { if (logger.isDebugEnabled()) { logger.debug("Input changed: old=" + oldInput + ", new=" + newInput); } } }); List<Object> list2 = new ArrayList<Object>(); list2.add(dummyConInstance); list2.addAll(schemaMeta.getDatabases().getList()); comboViewer.setInput(list2); comboViewer.setLabelProvider( new LabelProvider() { public Image getImage(Object element) { return null; } public String getText(Object element) { DatabaseMeta meta = (DatabaseMeta) element; if (DUMMY_CON_NAME.equals(meta.getName())) { return ""; } else { return ((DatabaseMeta) element).getName(); } } }); BusinessModel busModel = (BusinessModel) conceptUtil; if (null != busModel.getConnection()) { comboViewer.setSelection(new StructuredSelection(busModel.getConnection())); } else { comboViewer.setSelection(new StructuredSelection(dummyConInstance)); } FormData fdId = new FormData(); fdId.left = new FormAttachment(wlId, 10); fdId.top = new FormAttachment(0, 0); fdId.right = new FormAttachment(conLabel, -10); wId.setLayoutData(fdId); FormData fdConLabel = new FormData(); fdConLabel.left = new FormAttachment(50, 0); fdConLabel.top = new FormAttachment(conField, 0, SWT.CENTER); conLabel.setLayoutData(fdConLabel); FormData fdConField = new FormData(); fdConField.left = new FormAttachment(conLabel, 10); fdConField.top = new FormAttachment(0, 0); fdConField.right = new FormAttachment(100, 0); conField.setLayoutData(fdConField); if (conceptUtil.getId() != null) { wId.setText(conceptUtil.getId()); wId.selectAll(); } return c0; }