Java Code Examples for org.pentaho.ui.xul.binding.BindingConvertor

The following examples show how to use org.pentaho.ui.xul.binding.BindingConvertor. These examples are extracted from open source projects. 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 Project: pentaho-kettle   Source File: AbsController.java    License: Apache License 2.0 5 votes vote down vote up
@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 2
Source Project: pentaho-kettle   Source File: TrashBrowseController.java    License: Apache License 2.0 5 votes vote down vote up
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 3
public Binding createBinding(String sourceId, String sourceAttr, String targetId, String targetAttr,
    BindingConvertor... converters) {
  return DUMMY_BINDING;
}
 
Example 4
public Binding createBinding(Object source, String sourceAttr, String targetId, String targetAttr,
    BindingConvertor... converters) {
  return DUMMY_BINDING;
}
 
Example 5
public Binding createBinding(String sourceId, String sourceAttr, Object target, String targetAttr,
    BindingConvertor... converters) {
  return DUMMY_BINDING;
}
 
Example 6
public Binding createBinding(Object source, String sourceAttr, Object target, String targetAttr,
    BindingConvertor... converters) {
  return proxiedBindingFactory.createBinding(source, sourceAttr, target, targetAttr, converters);
}