org.pentaho.ui.xul.binding.Binding Java Examples
The following examples show how to use
org.pentaho.ui.xul.binding.Binding.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LinearWizardController.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
public void initialize() { if ( steps.isEmpty() ) { throw new IllegalStateException( messages.getString( "LINEAR_WIZARD_CONTROLLER.Empty_Steps_Error" ) ); //$NON-NLS-1$ } for ( final WizardStep wizardStep : steps ) { wizardStep.setBindings(); } bf.setBindingType( Binding.Type.ONE_WAY ); bf.createBinding( this, ACTIVE_STEP_PROPERTY_NAME, BACK_BTN_ELEMENT_ID, DISABLED_PROPERTY_NAME, new BackButtonBindingConverter() ); // bf.createBinding(this, ACTIVE_STEP_PROPERTY_NAME, STEP_PANEL_ELEMENT_ID, SELECTED_INDEX_PROPERTY_NAME); setActiveStep( 0 ); // Fires the events to update the buttons setCancelled( false ); setFinished( false ); }
Example #2
Source File: ConnectionsController.java From pentaho-kettle with Apache License 2.0 | 6 votes |
private void createBindings() { refreshConnectionList(); connectionsTable = (XulTree) document.getElementById( "connections-table" ); // Bind the connection table to a list of connections bf.setBindingType( Binding.Type.ONE_WAY ); //CHECKSTYLE:LineLength:OFF try { bf.createBinding( dbConnectionList, "children", connectionsTable, "elements" ).fireSourceChanged(); ( bindButtonNew = bf.createBinding( this, "repReadOnly", "connections-new", "disabled" ) ).fireSourceChanged(); ( bindButtonEdit = bf.createBinding( this, "repReadOnly", "connections-edit", "disabled" ) ).fireSourceChanged(); ( bindButtonRemove = bf.createBinding( this, "repReadOnly", "connections-remove", "disabled" ) ).fireSourceChanged(); if ( repository != null ) { bf.createBinding( connectionsTable, "selectedItems", this, "selectedConnections" ); } } catch ( Exception ex ) { if ( mainController == null || !mainController.handleLostRepository( ex ) ) { // convert to runtime exception so it bubbles up through the UI throw new RuntimeException( ex ); } } }
Example #3
Source File: FileOverwriteDialogController.java From pentaho-kettle with Apache License 2.0 | 6 votes |
public void init() { try { bf.setDocument( container.getDocumentRoot() ); mainController = (MainController) this.getXulDomContainer().getEventHandler( "mainController" ); bf.setBindingType( Binding.Type.ONE_WAY ); bf.createBinding( objects, "children", "file-list", "elements" ).fireSourceChanged(); } catch ( Exception e ) { if ( mainController == null || !mainController.handleLostRepository( e ) ) { new ErrorDialog( (Shell) container.getOuterContext(), BaseMessages.getString( PKG, "FileOverwriteDialog.ErrorDialog.Title" ), BaseMessages.getString( PKG, "FileOverwriteDialog.ErrorDialog.Message" ), e ); } } }
Example #4
Source File: FormatStep.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
public FormatStep() { super(); allExpressionMetaDatas = new ArrayList<MetaDataWrapper>(); this.allExpressionMetaDatas.add( new MetaDataWrapper( null ) ); // None for ( final ExpressionMetaData emd : ExpressionRegistry.getInstance().getAllExpressionMetaDatas() ) { if ( AggregationFunction.class.isAssignableFrom( emd.getExpressionType() ) ) { allExpressionMetaDatas.add( new MetaDataWrapper( emd ) ); } } formatStepHandler = new FormatStepHandler(); fieldAndGroupBindings = new ArrayList<Binding>(); }
Example #5
Source File: MainController.java From pentaho-aggdesigner with GNU General Public License v2.0 | 5 votes |
public void onLoad() { bindingFactory.setDocument(document); bindingFactory.setBindingType(Binding.Type.ONE_WAY); bindingFactory.createBinding(workspace, "saveEnabled", "save_button", "!disabled"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ bindingFactory.createBinding(workspace, "saveEnabled", "save_menuitem", "!disabled"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ bindingFactory.createBinding(workspace, "applicationUnlocked", "save_as_button", "!disabled"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ bindingFactory.createBinding(workspace, "applicationUnlocked", "save_as_menuitem", "!disabled"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ }
Example #6
Source File: AggController.java From pentaho-aggdesigner with GNU General Public License v2.0 | 5 votes |
/** * generate optional UI as required by Aggregate's output method * * @param thinAgg UIAggregate that we're working on * @throws XulException */ public void applyUiExtensions(UIAggregate thinAgg) { if (thinAgg == null) { removeUiExtensions(); return; } Output aggOutput = thinAgg.getOutput(); OutputUiExtension uiExtension = outputUIService.getUiExtension(aggOutput); //reload an extension (xul overlay) if the target extension has changed if (uiExtension != currentUiExtension) { removeUiExtensions(); } if (uiExtension == null) { return; } if (currentUiExtension != uiExtension) { try { document.addOverlay(uiExtension.getOverlayPath()); uiExtension.onLoad(); bindingFactory.setBindingType(Binding.Type.ONE_WAY); bindingFactory.createBinding(uiExtension, "modified", "apply_agg_btn", "!disabled"); bindingFactory.createBinding(uiExtension, "modified", "reset_agg_btn", "!disabled"); currentUiExtension = uiExtension; //aggModel needs a reference to the uiExtension so it can test for form modification aggModel.setCurrentUiExtension(uiExtension); } catch (Exception e) { logger.error("Error adding output UI extensions", e); } } currentUiExtension.loadOutput(aggOutput); }
Example #7
Source File: TrashBrowseController.java From pentaho-kettle with Apache License 2.0 | 5 votes |
private void createTrashTableBindings( BindingConvertor<List<UIDeletedObject>, Boolean> buttonConverter, XulTree trashFileTable ) { bf.createBinding( trashFileTable, "selectedItems", this, "selectedTrashFileItems" ); //$NON-NLS-1$ //$NON-NLS-2$ bf.createBinding( trashFileTable, "selectedItems", deleteButton, "!disabled", buttonConverter ); //$NON-NLS-1$ //$NON-NLS-2$ bf.createBinding( trashFileTable, "selectedItems", undeleteButton, "!disabled", buttonConverter ); //$NON-NLS-1$ //$NON-NLS-2$ bf.createBinding( trashFileTable, "selectedItems", "trash-context-delete", "!disabled", buttonConverter ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ bf.createBinding( trashFileTable, "selectedItems", "trash-context-restore", "!disabled", buttonConverter ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ bf.setBindingType( Binding.Type.ONE_WAY ); bf.createBinding( this, "trash", trashFileTable, "elements", //$NON-NLS-1$ //$NON-NLS-2$ new BindingConvertor<List<IDeletedObject>, List<UIDeletedObject>>() { @Override public List<UIDeletedObject> sourceToTarget( List<IDeletedObject> trash ) { List<UIDeletedObject> newList = new ArrayList<UIDeletedObject>( trash.size() ); for ( IDeletedObject obj : trash ) { newList.add( new UIDeletedObject( obj ) ); } Collections.sort( newList, new UIDeletedObjectComparator() ); return newList; } @Override public List<IDeletedObject> targetToSource( List<UIDeletedObject> elements ) { return null; } } ); }
Example #8
Source File: AbsController.java From pentaho-kettle with Apache License 2.0 | 5 votes |
@Override protected void createBindings() { super.createBindings(); roleListBox = (XulListbox) document.getElementById( "roles-list" );//$NON-NLS-1$ systemRoleListBox = (XulListbox) document.getElementById( "system-roles-list" );//$NON-NLS-1$ applyLogicalRolesButton = (XulButton) document.getElementById( "apply-action-permission" );//$NON-NLS-1$ applyLogicalSystemRolesButton = (XulButton) document.getElementById( "apply-system-role-action-permission" );//$NON-NLS-1$ logicalRolesBox = (XulVbox) document.getElementById( "role-action-permissions-vbox" );//$NON-NLS-1$ logicalSystemRolesBox = (XulVbox) document.getElementById( "system-role-action-permissions-vbox" );//$NON-NLS-1$ bf.setBindingType( Binding.Type.ONE_WAY ); // Action based security permissions buttonConverter = new BindingConvertor<Integer, Boolean>() { @Override public Boolean sourceToTarget( Integer value ) { if ( value != null && value >= 0 ) { return false; } return true; } @Override public Integer targetToSource( Boolean value ) { // TODO Auto-generated method stub return null; } }; bf.createBinding( roleListBox, "selectedIndex", applyLogicalRolesButton, "disabled", buttonConverter );//$NON-NLS-1$ //$NON-NLS-2$ bf.createBinding( systemRoleListBox, "selectedIndex", applyLogicalSystemRolesButton, "disabled", buttonConverter );//$NON-NLS-1$ //$NON-NLS-2$ bf.createBinding( absSecurity, "selectedRole", this, "selectedRoleChanged" );//$NON-NLS-1$ //$NON-NLS-2$ bf.createBinding( absSecurity, "selectedSystemRole", this, "selectedSystemRoleChanged" );//$NON-NLS-1$ //$NON-NLS-2$ }
Example #9
Source File: RulesExecutorDialog.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public void init() { workingStepname = stepname; metaMapper = new RulesExecutorMetaMapper(); metaMapper.loadMeta( (RulesExecutorMeta) baseStepMeta ); // Set dialog values ( (XulTextbox) document.getElementById( "step-name" ) ).setValue( getStepName() ); ( (XulTextbox) document.getElementById( "rule-file" ) ).setValue( metaMapper.getRuleFile() ); ( (XulTextbox) document.getElementById( "rule-definition" ) ).setValue( metaMapper.getRuleDefinition() ); ( (XulTree) document.getElementById( "fields-table" ) ).setElements( metaMapper.getColumnList() ); // Set the initial dialog state if ( metaMapper.getRuleDefinition() != null && !metaMapper.getRuleDefinition().equals( "" ) ) { setRuleSource( "definition" ); ( (XulRadio) document.getElementById( "rule-definition-radio-button" ) ).setSelected( true ); } else { setRuleSource( "file" ); ( (XulRadio) document.getElementById( "rule-file-radio-button" ) ).setSelected( true ); } // Bind data objects to UI bf.setBindingType( Binding.Type.ONE_WAY ); try { bf.createBinding( "step-name", "value", this, "stepName" ); bf.createBinding( "rule-file", "value", metaMapper, "ruleFile" ); bf.createBinding( "rule-definition", "value", metaMapper, "ruleDefinition" ); bf.createBinding( metaMapper.getColumnList(), "children", "fields-table", "elements" ).fireSourceChanged(); // TODO: Add converter to clear out opposing text box bf.createBinding( "rule-file-radio-button", "selected", "rule-file", "!disabled" ).fireSourceChanged(); bf.createBinding( "rule-file-radio-button", "selected", "rule-definition", "disabled" ).fireSourceChanged(); bf .createBinding( "rule-definition-radio-button", "selected", "rule-definition", "!disabled" ) .fireSourceChanged(); bf.createBinding( "rule-definition-radio-button", "selected", "rule-file", "disabled" ).fireSourceChanged(); } catch ( Exception e ) { e.printStackTrace(); } }
Example #10
Source File: RulesAccumulatorDialog.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public void init() { workingStepname = stepname; metaMapper = new RulesAccumulatorMetaMapper(); metaMapper.loadMeta( (RulesAccumulatorMeta) baseStepMeta ); // Set dialog values ( (XulTextbox) document.getElementById( "step-name" ) ).setValue( getStepName() ); ( (XulTextbox) document.getElementById( "rule-file" ) ).setValue( metaMapper.getRuleFile() ); ( (XulTextbox) document.getElementById( "rule-definition" ) ).setValue( metaMapper.getRuleDefinition() ); ( (XulTree) document.getElementById( "fields-table" ) ).setElements( metaMapper.getColumnList() ); // Set the initial dialog state if ( metaMapper.getRuleDefinition() != null && !metaMapper.getRuleDefinition().equals( "" ) ) { setRuleSource( "definition" ); ( (XulRadio) document.getElementById( "rule-definition-radio-button" ) ).setSelected( true ); } else { setRuleSource( "file" ); ( (XulRadio) document.getElementById( "rule-file-radio-button" ) ).setSelected( true ); } // Bind data objects to UI bf.setBindingType( Binding.Type.ONE_WAY ); try { bf.createBinding( "step-name", "value", this, "stepName" ); bf.createBinding( "rule-file", "value", metaMapper, "ruleFile" ); bf.createBinding( "rule-definition", "value", metaMapper, "ruleDefinition" ); bf.createBinding( metaMapper.getColumnList(), "children", "fields-table", "elements" ).fireSourceChanged(); // TODO: Add converter to clear out opposing text box bf.createBinding( "rule-file-radio-button", "selected", "rule-file", "!disabled" ).fireSourceChanged(); bf.createBinding( "rule-file-radio-button", "selected", "rule-definition", "disabled" ).fireSourceChanged(); bf .createBinding( "rule-definition-radio-button", "selected", "rule-definition", "!disabled" ) .fireSourceChanged(); bf.createBinding( "rule-definition-radio-button", "selected", "rule-file", "disabled" ).fireSourceChanged(); } catch ( Exception e ) { e.printStackTrace(); } }
Example #11
Source File: BrowseControllerTest.java From pentaho-kettle with Apache License 2.0 | 5 votes |
@Before public void setUp() throws Exception { DocumentFactory.registerElementClass( ElementDom4J.class ); controller = spy( new BrowseController() ); controller.setRepositoryDirectory( mock( UIRepositoryDirectory.class ) ); directoryMap = new HashMap<>( 8 ); controller.setDirMap( directoryMap ); document = mock( Document.class ); XulDomContainer xulDomContainer = mock( XulDomContainer.class ); when( xulDomContainer.getDocumentRoot() ).thenReturn( document ); controller.setXulDomContainer( xulDomContainer ); UIRepositoryDirectory someDirectory = mock( UIRepositoryDirectory.class ); selectedFolder = mock( UIRepositoryDirectory.class ); when( selectedFolder.createFolder( FOLDER_NAME ) ).thenReturn( someDirectory ); XulTree folderTree = mock( XulTree.class ); when( folderTree.getSelectedItems() ).thenReturn( Collections.<Object>singleton( selectedFolder ) ); controller.setFolderTree( folderTree ); directoryBinding = mock( Binding.class ); controller.setDirectoryBinding( directoryBinding ); selectedItemsBinding = mock( Binding.class ); controller.setSelectedItemsBinding( selectedItemsBinding ); }
Example #12
Source File: BasicAuthProvider.java From pentaho-kettle with Apache License 2.0 | 5 votes |
@Override protected void addBindings( List<Binding> bindings, BindingFactory bf ) { Binding b = bf.createBinding( this, "password", "password", "value" ); b.setBindingType( Binding.Type.BI_DIRECTIONAL ); bindings.add( b ); }
Example #13
Source File: KerberosAuthProvider.java From pentaho-kettle with Apache License 2.0 | 5 votes |
@Override protected void addBindings( List<Binding> bindings, BindingFactory bf ) { super.addBindings( bindings, bf ); Binding b = bf.createBinding( this, "keytabFile", "keytab", "value" ); b.setBindingType( Binding.Type.BI_DIRECTIONAL ); bindings.add( b ); b = bf.createBinding( this, "useKeytab", "useKeytab", "checked" ); b.setBindingType( Binding.Type.BI_DIRECTIONAL ); bindings.add( b ); b = bf.createBinding( "useKeytab", "checked", "keytab", "!disabled" ); b.setBindingType( Binding.Type.ONE_WAY ); bindings.add( b ); b = bf.createBinding( "useKeytab", "checked", "browse", "!disabled" ); b.setBindingType( Binding.Type.ONE_WAY ); bindings.add( b ); b = bf.createBinding( "useKeytab", "checked", "password", "disabled" ); b.setBindingType( Binding.Type.ONE_WAY ); bindings.add( b ); b = bf.createBinding( "useKeytab", "checked", "principal", "disabled" ); b.setBindingType( Binding.Type.ONE_WAY ); bindings.add( b ); }
Example #14
Source File: AbstractAuthProvider.java From pentaho-kettle with Apache License 2.0 | 5 votes |
@Override public void fireBindingsChanged() throws XulException, InvocationTargetException { for ( Binding bind : elementBindings ) { bind.fireSourceChanged(); } }
Example #15
Source File: AbstractAuthProvider.java From pentaho-kettle with Apache License 2.0 | 5 votes |
@Override public void unbind() { for ( Binding bind : elementBindings ) { bind.destroyBindings(); } elementBindings.clear(); }
Example #16
Source File: AbstractAuthProvider.java From pentaho-kettle with Apache License 2.0 | 5 votes |
@Override public void bind() throws BindingException, XulException, InvocationTargetException { unbind(); elementBindings = new ArrayList<Binding>(); Binding b = bf.createBinding( this, "principal", "principal", "value" ); b.setBindingType( Binding.Type.BI_DIRECTIONAL ); elementBindings.add( b ); addBindings( elementBindings, bf ); fireBindingsChanged(); }
Example #17
Source File: SlavesController.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public void createBindings() { refreshSlaves(); try { slavesTable = (XulTree) document.getElementById( "slaves-table" ); bf.setBindingType( Binding.Type.ONE_WAY ); bf.createBinding( slaveList, "children", slavesTable, "elements" ).fireSourceChanged(); bf.createBinding( slavesTable, "selectedItems", this, "enableButtons" ); } catch ( Exception e ) { if ( mainController == null || !mainController.handleLostRepository( e ) ) { // convert to runtime exception so it bubbles up through the UI throw new RuntimeException( e ); } } }
Example #18
Source File: LookAndFeelStep.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
public void setBindings() { // update the gui based on the selection getBindingFactory().setBindingType( Binding.Type.ONE_WAY ); final Binding typeBinding = getBindingFactory() .createBinding( NEW_WIZARD_FILE_RB_ID, SELECTED_PROPERTY_NAME, SELECT_LOOK_AND_FEEL_DECK_ID, SELECTED_INDEX_PROPERTY_NAME, new BooleanToIntegerBindingConverter() ); final Binding templatesBinding = getBindingFactory() .createBinding( this, TEMPLATES_PROPERTY_NAME, AVAILABLE_TEMPLATES_LB_ID, ELEMENTS_PROPERTY_NAME ); final Binding imageBinding = getBindingFactory().createBinding( this, SELECTED_TEMPLATE_PROPERTY_NAME, TEMPLATE_IMAGE_ID, SOURCE_PROPERTY_NAME, new SelectedTemplateToImageConverter() ); // update both the gui and the model getBindingFactory().setBindingType( Binding.Type.BI_DIRECTIONAL ); final Binding selectedTemplateBinding = getBindingFactory() .createBinding( this, SELECTED_TEMPLATE_PROPERTY_NAME, AVAILABLE_TEMPLATES_LB_ID, SELECTED_INDEX_PROPERTY_NAME ); getBindingFactory() .createBinding( this, START_FROM_FILE_PROPERTY_NAME, NEW_WIZARD_FILE_RB_ID, NOT_SELECTED_PROPERTY_NAME ); getBindingFactory().createBinding( this, FILENAME_PROPERTY_NAME, WIZARD_FILENAME_TB_ID, VALUE_PROPERTY_NAME ); try { typeBinding.fireSourceChanged(); templatesBinding.fireSourceChanged(); selectedTemplateBinding.fireSourceChanged(); imageBinding.fireSourceChanged(); } catch ( Exception e ) { if ( getDesignTimeContext() != null ) { getDesignTimeContext().error( e ); } } }
Example #19
Source File: FormatStep.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
/** * */ private void resetFieldAndGroupBindings() { // Get rid of all the old bindings for ( final Binding binding : fieldAndGroupBindings ) { binding.destroyBindings(); } fieldAndGroupBindings.clear(); }
Example #20
Source File: LinearWizardController.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
protected void updateBindings() { // Destroy any old bindings if ( nextButtonBinding != null ) { nextButtonBinding.destroyBindings(); } if ( finishedButtonBinding != null ) { finishedButtonBinding.destroyBindings(); } // if (previewButtonBinding != null) { // previewButtonBinding.destroyBindings(); // } // Create new binding to the current wizard panel bf.setBindingType( Binding.Type.ONE_WAY ); nextButtonBinding = bf.createBinding( getStep( getActiveStep() ), VALID_PROPERTY_NAME, NEXT_BTN_ELEMENT_ID, NOT_DISABLED_PROPERTY ); finishedButtonBinding = bf.createBinding( getStep( getActiveStep() ), FINISHABLE_PROPERTY_NAME, FINISH_BTN_ELEMENT_ID, NOT_DISABLED_PROPERTY ); // previewButtonBinding = bf.createBinding(getStep(getActiveStep()), PREVIEWABLE_PROPERTY_NAME, // PREVIEW_BTN_ELEMENT_ID, NOT_DISABLED_PROPERTY); try { nextButtonBinding.fireSourceChanged(); finishedButtonBinding.fireSourceChanged(); // previewButtonBinding.fireSourceChanged(); } catch ( Exception e ) { if ( designTimeContext == null ) { ExceptionDialog.showExceptionDialog( null, "Error", e.getMessage(), e ); } else { designTimeContext.error( e ); } } }
Example #21
Source File: ClustersController.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public void createBindings() { refreshClusters(); try { clustersTable = (XulTree) document.getElementById( "clusters-table" ); bf.setBindingType( Binding.Type.ONE_WAY ); bf.createBinding( clusterList, "children", clustersTable, "elements" ).fireSourceChanged(); bf.createBinding( clustersTable, "selectedItems", this, "enableButtons" ); } catch ( Exception e ) { if ( mainController == null || !mainController.handleLostRepository( e ) ) { throw new RuntimeException( e ); } } }
Example #22
Source File: PartitionsController.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public void createBindings() { refreshPartitions(); try { partitionsTable = (XulTree) document.getElementById( "partitions-table" ); bf.setBindingType( Binding.Type.ONE_WAY ); bf.createBinding( partitionList, "children", partitionsTable, "elements" ).fireSourceChanged(); bf.createBinding( partitionsTable, "selectedItems", this, "enableButtons" ); } catch ( Exception e ) { if ( mainController == null || !mainController.handleLostRepository( e ) ) { // convert to runtime exception so it bubbles up through the UI throw new RuntimeException( e ); } } }
Example #23
Source File: MondrianFileSchemaProviderTest.java From pentaho-aggdesigner with GNU General Public License v2.0 | 4 votes |
@Before public void setUp() throws Exception { /* * In this integration test, we want to mock only the XUL framework, all other components * we want to be the "real" ones. This will allow us to test application behavior without * dependency on a UI. */ context = new JUnit4Mockery(); doc = context.mock(Document.class); container = context.mock(XulDomContainer.class); // need some expectations here as setXulDomContainer calls getDocumentRoot on the container context.checking(new Expectations() { { allowing(container).getDocumentRoot(); will(returnValue(doc)); allowing(container).addEventHandler(with(any(XulEventHandler.class))); allowing(doc).addOverlay(with(any(String.class))); ignoring(container); allowing(doc).getElementById(with(aNonNull(String.class))); will(returnValue(context.mock(XulComponent.class, Long.toString(System.currentTimeMillis())))); allowing(doc).addInitializedBinding(with(any(Binding.class))); allowing(doc).invokeLater(with(any(Runnable.class))); //don't care if the controller uses invokeLater or not, this is UI stuff } }); schemaProvider.setXulDomContainer(container); //In order to really make this an integration test, there needs to be a BindingFactory that is injected into the controller //so we can mock or stub it out and allow the object->object bindings to actually be bound while the xulcomponent bindings //are consumed. Here we are proxying the BindingFactory to acheive this. bindingFactory.setDocument(doc); //setup the proxy binding factory that will ignore all XUL stuff XulSupressingBindingFactoryProxy proxy = new XulSupressingBindingFactoryProxy(); proxy.setProxiedBindingFactory(bindingFactory); schemaProvider.setBindingFactory(proxy); schemaProvider.onLoad(); eventRecorder = new EventRecorder(); eventRecorder.setLogging(true); eventRecorder.record(schemaProvider); }
Example #24
Source File: ConnectionControllerITest.java From pentaho-aggdesigner with GNU General Public License v2.0 | 4 votes |
@Before public void setUp() throws Exception { /* * In this integration test, we want to mock only the XUL framework, all other components * we want to be the "real" ones. This will allow us to test application behavior without * dependency on a UI. */ context = new JUnit4Mockery(); eventRecorder = new EventRecorder(); doc = context.mock(Document.class); container = context.mock(XulDomContainer.class); // need some expectations here as setXulDomContainer calls getDocumentRoot on the container context.checking(new Expectations() { { allowing(container).getDocumentRoot(); will(returnValue(doc)); allowing(container).addEventHandler(with(any(XulEventHandler.class))); allowing(doc).addOverlay(with(any(String.class))); ignoring(container); allowing(doc).getElementById(with(aNonNull(String.class))); will(returnValue(context.mock(XulComponent.class, Long.toString(System.currentTimeMillis())))); allowing(doc).addInitializedBinding(with(any(Binding.class))); allowing(doc).invokeLater(with(any(Runnable.class))); //don't care if the controller uses invokeLater or not, this is UI stuff } }); controller.setXulDomContainer(container); //In order to really make this an integration test, there needs to be a BindingFactory that is injected into the controller //so we can mock or stub it out and allow the object->object bindings to actually be bound while the xulcomponent bindings //are consumed. Here we are proxying the BindingFactory to achieve this. bindingFactory.setDocument(doc); //setup the proxy binding factory that will ignore all XUL stuff XulSupressingBindingFactoryProxy proxy = new XulSupressingBindingFactoryProxy(); proxy.setProxiedBindingFactory(bindingFactory); controller.setBindingFactory(proxy); for(MondrianFileSchemaProvider provider : mondrianFileSchemaProviders) { provider.setXulDomContainer(container); provider.setBindingFactory(proxy); } // this model gets reused across tests. Revert to default value. model.setApplySchemaSourceEnabled( false ); }
Example #25
Source File: DocumentStub.java From pentaho-aggdesigner with GNU General Public License v2.0 | 4 votes |
public void addInitializedBinding(Binding b) { bindings.add(b); }
Example #26
Source File: DocumentStub.java From pentaho-aggdesigner with GNU General Public License v2.0 | 4 votes |
public void addBinding(Binding bind) { bindings.add(bind); }
Example #27
Source File: XulSupressingBindingFactoryProxy.java From pentaho-aggdesigner with GNU General Public License v2.0 | 4 votes |
public Binding createBinding(Object source, String sourceAttr, Object target, String targetAttr, BindingConvertor... converters) { return proxiedBindingFactory.createBinding(source, sourceAttr, target, targetAttr, converters); }
Example #28
Source File: XulSupressingBindingFactoryProxy.java From pentaho-aggdesigner with GNU General Public License v2.0 | 4 votes |
public Binding createBinding(String sourceId, String sourceAttr, Object target, String targetAttr, BindingConvertor... converters) { return DUMMY_BINDING; }
Example #29
Source File: XulSupressingBindingFactoryProxy.java From pentaho-aggdesigner with GNU General Public License v2.0 | 4 votes |
public Binding createBinding(Object source, String sourceAttr, String targetId, String targetAttr, BindingConvertor... converters) { return DUMMY_BINDING; }
Example #30
Source File: XulSupressingBindingFactoryProxy.java From pentaho-aggdesigner with GNU General Public License v2.0 | 4 votes |
public Binding createBinding(String sourceId, String sourceAttr, String targetId, String targetAttr, BindingConvertor... converters) { return DUMMY_BINDING; }