public void newNote() { String title = BaseMessages.getString( PKG, "JobGraph.Dialog.EditNote.Title" ); NotePadDialog dd = new NotePadDialog( jobMeta, shell, title ); NotePadMeta n = dd.open(); if ( n != null ) { NotePadMeta npi = new NotePadMeta( n.getNote(), lastclick.x, lastclick.y, ConstUI.NOTE_MIN_SIZE, ConstUI.NOTE_MIN_SIZE, n .getFontName(), n.getFontSize(), n.isFontBold(), n.isFontItalic(), n.getFontColorRed(), n .getFontColorGreen(), n.getFontColorBlue(), n.getBackGroundColorRed(), n.getBackGroundColorGreen(), n .getBackGroundColorBlue(), n.getBorderColorRed(), n.getBorderColorGreen(), n.getBorderColorBlue(), n .isDrawShadow() ); jobMeta.addNote( npi ); spoon.addUndoNew( jobMeta, new NotePadMeta[] { npi }, new int[] { jobMeta.indexOfNote( npi ) } ); redraw(); } }
/** * Get an array of all the selected note locations. * * @return The selected note locations. */ public Point[] getSelectedNoteLocations() { List<Point> points = new ArrayList<>(); for ( NotePadMeta ni : getSelectedNotes() ) { Point p = ni.getLocation(); points.add( new Point( p.x, p.y ) ); // explicit copy of location } return points.toArray( new Point[points.size()] ); }
/** * Gets a list of all selected notes. * * @return A list of all the selected notes. */ public List<NotePadMeta> getSelectedNotes() { List<NotePadMeta> selection = new ArrayList<NotePadMeta>(); for ( NotePadMeta note : notes ) { if ( note.isSelected() ) { selection.add( note ); } } return selection; }
/** * * @param rep * @param id_transformation * @throws KettleException */ public void saveNotePadMeta( NotePadMeta note, ObjectId id_transformation ) throws KettleException { try { Point location = note.getLocation(); int x = location == null ? -1 : location.x; int y = location == null ? -1 : location.y; // Insert new Note in repository note.setObjectId( insertNote( note.getNote(), x, y, note.getWidth(), note.getHeight(), note.getFontName(), note.getFontSize(), note .isFontBold(), note.isFontItalic(), note.getFontColorRed(), note.getFontColorGreen(), note .getFontColorBlue(), note.getBackGroundColorRed(), note.getBackGroundColorGreen(), note .getBackGroundColorBlue(), note.getBorderColorRed(), note.getBorderColorGreen(), note .getBorderColorBlue(), note.isDrawShadow() ) ); } catch ( KettleDatabaseException dbe ) { throw new KettleException( "Unable to save notepad in repository (id_transformation=" + id_transformation + ")", dbe ); } }
protected void editNote( NotePadMeta ni ) { NotePadMeta before = (NotePadMeta) ni.clone(); String title = BaseMessages.getString( PKG, "JobGraph.Dialog.EditNote.Title" ); NotePadMeta n = dd.open(); if ( n != null ) { ni.setChanged(); ni.setNote( n.getNote() ); ni.setFontName( n.getFontName() ); ni.setFontSize( n.getFontSize() ); ni.setFontBold( n.isFontBold() ); ni.setFontItalic( n.isFontItalic() ); ni.setFontColorRed( n.getFontColorRed() ); ni.setFontColorGreen( n.getFontColorGreen() ); ni.setFontColorBlue( n.getFontColorBlue() ); ni.setBackGroundColorRed( n.getBackGroundColorRed() ); ni.setBackGroundColorGreen( n.getBackGroundColorGreen() ); ni.setBackGroundColorBlue( n.getBackGroundColorBlue() ); ni.setBorderColorRed( n.getBorderColorRed() ); ni.setBorderColorGreen( n.getBorderColorGreen() ); ni.setBorderColorBlue( n.getBorderColorBlue() ); ni.setDrawShadow( n.isDrawShadow() );
public NotePadMeta loadNotePadMeta( ObjectId id_note ) throws KettleException { NotePadMeta note = new NotePadMeta(); try { note.setObjectId( id_note ); note.setNote( r.getString( "VALUE_STR", "" ) ); int x = (int) r.getInteger( "GUI_LOCATION_X", 0L ); int y = (int) r.getInteger( "GUI_LOCATION_Y", 0L ); note.setLocation( new Point( x, y ) ); note.setWidth( (int) r.getInteger( "GUI_LOCATION_WIDTH", 0L ) ); note.setHeight( (int) r.getInteger( "GUI_LOCATION_HEIGHT", 0L ) ); note.setSelected( false ); note.setFontName( r.getString( "FONT_NAME", null ) ); note.setFontSize( (int) r.getInteger( "FONT_SIZE", -1 ) ); note.setFontBold( r.getBoolean( "FONT_BOLD", false ) ); note.setFontItalic( r.getBoolean( "FONT_ITALIC", false ) ); note.setFontColorRed( (int) r.getInteger( "FONT_COLOR_RED", NotePadMeta.COLOR_RGB_BLACK_BLUE ) ); note.setFontColorGreen( (int) r.getInteger( "FONT_COLOR_GREEN", NotePadMeta.COLOR_RGB_BLACK_GREEN ) ); note.setFontColorBlue( (int) r.getInteger( "FONT_COLOR_BLUE", NotePadMeta.COLOR_RGB_BLACK_BLUE ) ); note.setBackGroundColorRed( (int) r.getInteger( "FONT_BACK_GROUND_COLOR_RED", NotePadMeta.COLOR_RGB_DEFAULT_BG_RED ) ); note.setBackGroundColorGreen( (int) r.getInteger( "FONT_BACK_GROUND_COLOR_GREEN", NotePadMeta.COLOR_RGB_DEFAULT_BG_GREEN ) ); note.setBackGroundColorBlue( (int) r.getInteger( "FONT_BACK_GROUND_COLOR_BLUE", NotePadMeta.COLOR_RGB_DEFAULT_BG_BLUE ) ); note.setBorderColorRed( (int) r.getInteger(
private void ok() { notePadMeta = new NotePadMeta(); if ( wDesc.getText() != null ) { notePadMeta.setNote( wDesc.getText() ); } if ( wFontName.getText() != null ) { notePadMeta.setFontName( wFontName.getText() ); } notePadMeta.setFontSize( wFontSize.getSelection() ); notePadMeta.setFontBold( wFontBold.getSelection() ); notePadMeta.setFontItalic( wFontItalic.getSelection() ); // font color notePadMeta.setFontColorRed( wFontColor.getBackground().getRed() ); notePadMeta.setFontColorGreen( wFontColor.getBackground().getGreen() ); notePadMeta.setFontColorBlue( wFontColor.getBackground().getBlue() ); // background color notePadMeta.setBackGroundColorRed( wBackGroundColor.getBackground().getRed() ); notePadMeta.setBackGroundColorGreen( wBackGroundColor.getBackground().getGreen() ); notePadMeta.setBackGroundColorBlue( wBackGroundColor.getBackground().getBlue() ); // border color notePadMeta.setBorderColorRed( wBorderColor.getBackground().getRed() ); notePadMeta.setBorderColorGreen( wBorderColor.getBackground().getGreen() ); notePadMeta.setBorderColorBlue( wBorderColor.getBackground().getBlue() ); notePadMeta.setDrawShadow( wDrawShadow.getSelection() ); dispose(); }
/** * Loads a NotePadMeta object from a CWM model using the supplied CWM Description object * * @param cwm * @param cwmDescription * @return a newly created NotePadMeta object */ public NotePadMeta getNotePadMeta( CWM cwm, CwmDescription cwmDescription ) { NotePadMeta notePadMeta = new NotePadMeta(); // The text notePadMeta.setNote( cwmDescription.getBody() ); // The position & dimensions notePadMeta.setLocation( cwm.getPositionX( cwmDescription ), cwm.getPositionY( cwmDescription ) ); notePadMeta.setWidth( cwm.getPositionWidth( cwmDescription ) ); notePadMeta.setHeight( cwm.getPositionHeight( cwmDescription ) ); return notePadMeta; }
notes[i] = new NotePadMeta( noteNode ); Point p = notes[i].getLocation(); notes[i].setLocation( p.x + offset.x, p.y + offset.y ); transMeta.addNote( notes[i] ); notes[i].setSelected( true );
previous_step_locations = new Point[] { selectedEntry.getLocation() }; redraw(); } else if ( selectedNote != null && !selectedNote.isSelected() ) { jobMeta.unselectAll(); selectedNote.setSelected( true ); selectedNotes = new ArrayList<>(); selectedNotes.add( selectedNote ); previous_note_locations = new Point[] { selectedNote.getLocation() }; redraw(); } else if ( selectionRegion != null && startHopEntry == null ) { for ( int i = 0; i < selectedNotes.size(); i++ ) { NotePadMeta ni = selectedNotes.get( i ); PropsUI.setLocation( ni, ni.getLocation().x + dx, ni.getLocation().y + dy ); int dx = note.x - selectedNote.getLocation().x; int dy = note.y - selectedNote.getLocation().y; for ( int i = 0; i < selectedNotes.size(); i++ ) { NotePadMeta ni = selectedNotes.get( i ); PropsUI.setLocation( ni, ni.getLocation().x + dx, ni.getLocation().y + dy );
/** * Stores a notepad in the CWM model in a CwmSchema. * * @param cwm * @param cwmSchema * @param notePadMeta */ public void storeNotePadMeta( CWM cwm, CwmSchema cwmSchema, NotePadMeta notePadMeta ) { if ( !hasAccess( CwmSchemaFactoryInterface.ACCESS_TYPE_SCHEMA_ADMIN, null ) ) { throw new CwmSchemaFactoryException( Messages .getString( "CwmSchemaFactory.ERROR_0001_SCHEMA_ADMIN_ACCESS_DENIED" ) ); //$NON-NLS-1$ } CwmDescription cwmDescription = cwm.createDescription( notePadMeta.getNote() ); cwmDescription.setType( CWM.DESCRIPTION_TYPE_NOTEPAD ); cwm.setPosition( cwmDescription, notePadMeta.getLocation().x, notePadMeta.getLocation().y ); cwm.setWidth( cwmDescription, notePadMeta.getWidth() ); cwm.setHeight( cwmDescription, notePadMeta.getHeight() ); cwm.setDescription( cwmSchema, cwmDescription ); }
new NotePadMeta( "This is a generated slave transformation.\nIt will be run on slave server: " + slaveServer, 0, 0, -1, -1 ); transMeta.addNote( slaveNote ); new NotePadMeta( "This is a generated master transformation.\nIt will be run on server: " + getMasterServer(), 0, 0, -1, -1 ); transMeta.addNote( masterNote );
public void selectInRect( JobMeta jobMeta, org.pentaho.di.core.gui.Rectangle rect ) { int i; for ( i = 0; i < jobMeta.nrJobEntries(); i++ ) { JobEntryCopy je = jobMeta.getJobEntry( i ); Point p = je.getLocation(); if ( ( ( p.x >= rect.x && p.x <= rect.x + rect.width ) || ( p.x >= rect.x + rect.width && p.x <= rect.x ) ) && ( ( p.y >= rect.y && p.y <= rect.y + rect.height ) || ( p.y >= rect.y + rect.height && p.y <= rect.y ) ) ) { je.setSelected( true ); } } for ( i = 0; i < jobMeta.nrNotes(); i++ ) { NotePadMeta ni = jobMeta.getNote( i ); Point a = ni.getLocation(); Point b = new Point( a.x + ni.width, a.y + ni.height ); if ( rect.contains( a.x, a.y ) && rect.contains( b.x, b.y ) ) { ni.setSelected( true ); } } }
assertTrue( meta.hasChanged() ); NotePadMeta note2 = mock( NotePadMeta.class ); when( note2.getLocation() ).thenReturn( new Point( 0, 0 ) ); when( note2.isSelected() ).thenReturn( true ); meta.addNote( 1, note2 ); assertEquals( note2, meta.getNote( 0, 0 ) );
transMeta.removeNote( idx ); NotePadMeta prev = (NotePadMeta) transAction.getPrevious()[i]; transMeta.addNote( idx, (NotePadMeta) prev.clone() ); NotePadMeta npi = transMeta.getNote( idx ); Point prev = transAction.getPreviousLocation()[i]; npi.setLocation( prev );
if ( notes != null ) { for ( NotePadMeta note : notes ) { xml.append( note.getXML() );
public void setLocation( int x, int y ) { if ( x != location.x || y != location.y ) { setChanged(); } location.x = x; location.y = y; }
public void setLocation( Point p ) { setLocation( p.x, p.y ); }
public void deleteNote() { selectionRegion = null; int idx = transMeta.indexOfNote( ni ); if ( idx >= 0 ) { transMeta.removeNote( idx ); spoon.addUndoDelete( transMeta, new NotePadMeta[] { (NotePadMeta) ni.clone() }, new int[] { idx } ); redraw(); } }