idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
15,100
public static Map < String , Object > getAllDatePatterns ( ) throws IllegalAccessException { final Field [ ] fields = DatePatterns . class . getFields ( ) ; final Map < String , Object > patterns = new HashMap < > ( fields . length ) ; for ( final Field field : fields ) { patterns . put ( field . getName ( ) , field . ...
Returns a map with all date patterns from the Interface DatePatterns . As key is the name from the pattern .
15,101
private Control createPageControl ( Composite parent ) { Composite composite = new Composite ( parent , SWT . NONE ) ; composite . setLayout ( new GridLayout ( 1 , false ) ) ; GridData gridData = new GridData ( GridData . HORIZONTAL_ALIGN_FILL | GridData . VERTICAL_ALIGN_FILL ) ; composite . setLayoutData ( gridData ) ...
Creates custom control for user - defined query text .
15,102
private void initializeControl ( ) { DataSetDesign dataSetDesign = getInitializationDesign ( ) ; if ( dataSetDesign == null ) return ; String queryText = dataSetDesign . getQueryText ( ) ; if ( queryText == null ) return ; m_queryTextField . setText ( queryText ) ; validateData ( ) ; setMessage ( DEFAULT_MESSAGE ) ; }
Initializes the page control with the last edited data set design .
15,103
private void validateData ( ) { boolean isValid = ( m_queryTextField != null && getQueryText ( ) != null && getQueryText ( ) . trim ( ) . length ( ) > 0 ) ; if ( isValid ) setMessage ( DEFAULT_MESSAGE ) ; else setMessage ( "Requires input value." , ERROR ) ; setPageComplete ( isValid ) ; }
Validates the user - defined value in the page control exists and not a blank text . Set page message accordingly .
15,104
private void savePage ( DataSetDesign dataSetDesign ) { String queryText = getQueryText ( ) ; dataSetDesign . setQueryText ( queryText ) ; IConnection customConn = null ; try { IDriver customDriver = new org . orienteer . birt . orientdb . impl . Driver ( ) ; customConn = customDriver . getConnection ( null ) ; java . ...
Saves the user - defined value in this page and updates the specified dataSetDesign with the latest design definition .
15,105
private void updateDesign ( DataSetDesign dataSetDesign , IConnection conn , String queryText ) throws OdaException { IQuery query = conn . newQuery ( null ) ; query . prepare ( queryText ) ; try { IResultSetMetaData md = query . getMetaData ( ) ; updateResultSetDesign ( md , dataSetDesign ) ; } catch ( OdaException e ...
Updates the given dataSetDesign with the queryText and its derived metadata obtained from the ODA runtime connection .
15,106
private void updateResultSetDesign ( IResultSetMetaData md , DataSetDesign dataSetDesign ) throws OdaException { ResultSetColumns columns = DesignSessionUtil . toResultSetColumnsDesign ( md ) ; ResultSetDefinition resultSetDefn = DesignFactory . eINSTANCE . createResultSetDefinition ( ) ; resultSetDefn . setResultSetCo...
Updates the specified data set design s result set definition based on the specified runtime metadata .
15,107
private void updateParameterDesign ( IParameterMetaData paramMd , DataSetDesign dataSetDesign ) throws OdaException { DataSetParameters paramDesign = DesignSessionUtil . toDataSetParametersDesign ( paramMd , DesignSessionUtil . toParameterModeDesign ( IParameterMetaData . parameterModeIn ) ) ; dataSetDesign . setParame...
Updates the specified data set design s parameter definition based on the specified runtime metadata .
15,108
private void closeConnection ( IConnection conn ) { try { if ( conn != null && conn . isOpen ( ) ) conn . close ( ) ; } catch ( OdaException e ) { e . printStackTrace ( ) ; } }
Attempts to close given ODA connection .
15,109
public int getManhattanDistance ( Point2 that ) { return Math . abs ( x - that . x ) + Math . abs ( y - that . y ) ; }
Returns the manhattan distance between this and specified points .
15,110
public Point2 move ( Direction4 direction ) { return new Point2 ( x + direction . dx , y + direction . dy ) ; }
This method is deprecated so please use move method in Direction4 . Returns the moved location from this position with the specified direction .
15,111
public BaseField setupField ( int iFieldSeq ) { BaseField field = null ; if ( iFieldSeq == DBConstants . MAIN_FIELD ) field = new CounterField ( this , "ID" , Constants . DEFAULT_FIELD_LENGTH , null , null ) ; return field ; }
Add this field in the Record s field sequence ..
15,112
public KeyArea setupKey ( int iKeyArea ) { KeyArea keyArea = null ; if ( iKeyArea == DBConstants . MAIN_KEY_FIELD ) { keyArea = this . makeIndex ( DBConstants . UNIQUE , DBConstants . PRIMARY_KEY ) ; keyArea . addKeyField ( DBConstants . MAIN_FIELD , DBConstants . ASCENDING ) ; } return keyArea ; }
Add this key area description to the Record ..
15,113
private static < T extends Node > Map . Entry < CSNodeWrapper , T > findEntry ( Map < CSNodeWrapper , T > map , Integer id ) { if ( id == null ) return null ; for ( final Map . Entry < CSNodeWrapper , T > entry : map . entrySet ( ) ) { if ( entry . getKey ( ) . getNextNode ( ) != null && entry . getKey ( ) . getNextNod...
Find the entry how has a next node that matches a specified by a node id .
15,114
private static < T extends Node > Map . Entry < CSNodeWrapper , T > findLastEntry ( Map < CSNodeWrapper , T > map ) { Map . Entry < CSNodeWrapper , T > nodeEntry = null ; for ( final Map . Entry < CSNodeWrapper , T > entry : map . entrySet ( ) ) { if ( entry . getKey ( ) . getNextNode ( ) == null ) { nodeEntry = entry ...
Finds the initial entry for the unordered map .
15,115
public boolean checkSecurity ( JBasePanel baseScreen ) { if ( ( this . getApplication ( ) == null ) || ( baseScreen == null ) ) return true ; int iErrorCode = baseScreen . checkSecurity ( this . getApplication ( ) ) ; if ( iErrorCode == Constants . READ_ACCESS ) { int iLevel = Constants . LOGIN_USER ; try { iLevel = In...
This is just for convenience . A simple way to change or set the screen for this applet . The old screen is removed and the new screen is added . This method is also used to switch a sub - screen to a new sub - screen .
15,116
public int onLogonDialog ( ) { String strDisplay = "Login required" ; strDisplay = this . getTask ( ) . getString ( strDisplay ) ; for ( int i = 1 ; i < 3 ; i ++ ) { String strUserName = this . getProperty ( Params . USER_NAME ) ; Frame frame = ScreenUtil . getFrame ( this ) ; LoginDialog dialog = new LoginDialog ( fra...
Display the logon dialog and login .
15,117
public int onChangePassword ( ) { String strDisplay = "Login required" ; strDisplay = this . getTask ( ) . getString ( strDisplay ) ; for ( int i = 1 ; i < 3 ; i ++ ) { String strUserName = this . getProperty ( Params . USER_NAME ) ; Frame frame = ScreenUtil . getFrame ( this ) ; ChangePasswordDialog dialog = new Chang...
Display the change password dialog and change the password .
15,118
public boolean changeSubScreen ( Container parent , JBasePanel baseScreen , String strCommandToPush , int options ) { if ( ( parent == null ) || ( parent == this ) ) parent = m_parent ; boolean bScreenChange = false ; if ( ! this . checkSecurity ( baseScreen ) ) { baseScreen . free ( ) ; return false ; } this . freeSub...
Change the sub - screen .
15,119
public ImageIcon loadImageIcon ( String filename , String description ) { filename = Util . getImageFilename ( filename , "buttons" ) ; URL url = null ; if ( this . getApplication ( ) != null ) url = this . getApplication ( ) . getResourceURL ( filename , this ) ; if ( url == null ) { try { return new ImageIcon ( filen...
Get this image .
15,120
public void setBackgroundColor ( Color colorBackground ) { m_colorBackground = colorBackground ; if ( m_parent != null ) { JTiledImage panel = ( JTiledImage ) JBasePanel . getSubScreen ( this , JTiledImage . class ) ; if ( panel != null ) panel . setBackground ( colorBackground ) ; } }
Set the background image s color .
15,121
public static Color nameToColor ( String strColor ) { final Object [ ] [ ] obj = { { "black" , Color . black } , { "blue" , Color . blue } , { "cyan" , Color . cyan } , { "darkGray" , Color . darkGray } , { "gray" , Color . gray } , { "green" , Color . green } , { "lightGray" , Color . lightGray } , { "magenta" , Color...
Convert this color string to the Color object .
15,122
public boolean doAction ( String strAction , int iOptions ) { if ( Constants . BACK . equalsIgnoreCase ( strAction ) ) { String strPrevAction = this . popHistory ( 1 , false ) ; strAction = this . popHistory ( 1 , false ) ; if ( strAction != null ) { this . pushHistory ( strAction , false ) ; strAction = this . popHist...
Do some applet - wide action . For example submit or reset . Pass this action down to all the JBaseScreens . Remember to override this method to send the actual data!
15,123
public int getHelpPageOptions ( int iOptions ) { String strPreference = this . getProperty ( ThinMenuConstants . USER_HELP_DISPLAY ) ; if ( ( strPreference == null ) || ( strPreference . length ( ) == 0 ) ) strPreference = this . getProperty ( ThinMenuConstants . HELP_DISPLAY ) ; if ( this . getHelpView ( ) == null ) i...
Get the display preference for the help window .
15,124
public RemoteSession makeRemoteSession ( RemoteSession parentSessionObject , String strSessionClass ) { RemoteTask server = ( RemoteTask ) this . getRemoteTask ( ) ; try { synchronized ( server ) { if ( parentSessionObject == null ) return ( RemoteSession ) server . makeRemoteSession ( strSessionClass ) ; else return (...
Create this session with this class name at the remote server .
15,125
public String popHistory ( int quanityToPop , boolean bPopFromBrowser ) { String strHistory = null ; for ( int i = 0 ; i < quanityToPop ; i ++ ) { strHistory = null ; if ( m_vHistory != null ) if ( m_vHistory . size ( ) > 0 ) strHistory = ( String ) m_vHistory . remove ( m_vHistory . size ( ) - 1 ) ; } if ( bPopFromBro...
Pop this command off the history stack .
15,126
public void popBrowserHistory ( int quanityToPop , boolean bCommandHandledByJava , String browserTitle ) { if ( this . getBrowserManager ( ) != null ) this . getBrowserManager ( ) . popBrowserHistory ( quanityToPop , bCommandHandledByJava , this . getStatusText ( Constants . INFORMATION ) ) ; }
Pop commands off the browser stack .
15,127
public String getInitialCommand ( boolean bIncludeAppletCommands ) { String strCommand = Constants . BLANK ; if ( bIncludeAppletCommands ) { if ( this . getProperty ( Params . APPLET ) != null ) strCommand = Util . addURLParam ( strCommand , Params . APPLET , this . getProperty ( Params . APPLET ) ) ; else if ( this . ...
Get the original screen params .
15,128
public String cleanCommand ( String command ) { if ( command == null ) return command ; Map < String , Object > properties = Util . parseArgs ( null , command ) ; properties . remove ( Params . APPLET ) ; properties . remove ( "code" ) ; properties . remove ( "jnlpjars" ) ; properties . remove ( "jnlpextensions" ) ; pr...
Clean the javascript command for java use .
15,129
public boolean onAbout ( ) { Application application = this . getApplication ( ) ; application . getResources ( null , true ) ; String strTitle = this . getString ( ThinMenuConstants . ABOUT ) ; String strMessage = this . getString ( "Copyright" ) ; JOptionPane . showMessageDialog ( ScreenUtil . getFrame ( this ) , str...
Throw up a dialog box to show about info .
15,130
public void setScreenProperties ( PropertyOwner propertyOwner , Map < String , Object > properties ) { Frame frame = ScreenUtil . getFrame ( this ) ; ScreenUtil . updateLookAndFeel ( ( Frame ) frame , propertyOwner , properties ) ; Color colorBackgroundNew = ScreenUtil . getColor ( ScreenUtil . BACKGROUND_COLOR , prope...
Change the screen properties to these properties .
15,131
@ SuppressWarnings ( { "unchecked" , "rawtypes" } ) public void setupLookAndFeel ( PropertyOwner propertyOwner ) { Map < String , Object > properties = null ; if ( propertyOwner == null ) propertyOwner = this . retrieveUserProperties ( Params . SCREEN ) ; if ( propertyOwner == null ) { RemoteTask task = ( RemoteTask ) ...
Get the screen properties and set up the look and feel .
15,132
public GridBagConstraints getGBConstraints ( ) { if ( m_gbconstraints == null ) m_gbconstraints = new GridBagConstraints ( ) ; else { m_gbconstraints . gridx = GridBagConstraints . RELATIVE ; m_gbconstraints . gridy = GridBagConstraints . RELATIVE ; m_gbconstraints . gridwidth = 1 ; m_gbconstraints . gridheight = 1 ; m...
Get standard GridBagConstraints . The grid bag constrain is reset to the original value in this method .
15,133
public String getMenuIcon ( FieldList record ) { FieldInfo field = record . getField ( "IconResource" ) ; String strIcon = null ; if ( field != null ) { strIcon = field . toString ( ) ; if ( ( strIcon != null ) && ( strIcon . length ( ) > 0 ) ) return strIcon ; } field = record . getField ( "Type" ) ; if ( ( field != n...
Get the menu icon .
15,134
public String getMenuLink ( FieldList record ) { FieldInfo field = record . getField ( "Type" ) ; if ( ( field != null ) && ( ! field . isNull ( ) ) ) { String strType = field . toString ( ) ; String strParams = record . getField ( "Params" ) . toString ( ) ; if ( strParams == null ) strParams = Constants . BLANK ; els...
Get the menu command to send to handle command .
15,135
public static byte [ ] download ( final URI uri ) throws IOException { final File tmpFile = new File ( uri ) ; return ReadFileExtensions . toByteArray ( tmpFile ) ; }
Downloads Data from the given URI .
15,136
public static String getAbsolutPathWithoutFilename ( final File file ) { final String absolutePath = file . getAbsolutePath ( ) ; int lastSlash_index = absolutePath . lastIndexOf ( "/" ) ; if ( lastSlash_index < 0 ) { lastSlash_index = absolutePath . lastIndexOf ( "\\" ) ; } return absolutePath . substring ( 0 , lastSl...
Gets the absolut path without the filename .
15,137
public static String getCurrentAbsolutPathWithoutDotAndSlash ( ) { final File currentAbsolutPath = new File ( "." ) ; return currentAbsolutPath . getAbsolutePath ( ) . substring ( 0 , currentAbsolutPath . getAbsolutePath ( ) . length ( ) - 2 ) ; }
Gets the current absolut path without the dot and slash .
15,138
public static boolean isOpen ( final File file ) throws IOException { boolean open = false ; FileLock lock = null ; try ( RandomAccessFile fileAccess = new RandomAccessFile ( file . getAbsolutePath ( ) , "rw" ) ) { lock = fileAccess . getChannel ( ) . tryLock ( ) ; if ( lock == null ) { open = true ; } else { lock . re...
Not yet implemented . Checks if the given file is open .
15,139
public static MappedByteBuffer create ( MapMode mapMode , int maxSize ) throws IOException { Path tmp = Files . createTempFile ( "dynBB" , "tmp" ) ; try ( FileChannel fc = FileChannel . open ( tmp , READ , WRITE , CREATE , DELETE_ON_CLOSE ) ) { return fc . map ( MapMode . READ_WRITE , 0 , maxSize ) ; } }
Creates dynamically growing ByteBuffer upto maxSize . ByteBuffer is created by mapping a temporary file
15,140
public static ByteBuffer create ( Path path , int maxSize ) throws IOException { try ( FileChannel fc = FileChannel . open ( path , READ , WRITE , CREATE ) ) { return fc . map ( FileChannel . MapMode . READ_WRITE , 0 , maxSize ) ; } }
Creates dynamically growing ByteBuffer upto maxSize for named file .
15,141
public String formatDate ( Date date , int type ) { String string = null ; if ( type == DBConstants . DATE_TIME_FORMAT ) string = XmlUtilities . dateTimeFormat . format ( date ) ; else if ( type == DBConstants . DATE_ONLY_FORMAT ) string = XmlUtilities . dateFormat . format ( date ) ; else if ( type == DBConstants . TI...
FormatDate Method .
15,142
public void fieldToControl ( ) { if ( this . getConverter ( ) != null ) { Object objValue = this . getScreenFieldView ( ) . getFieldState ( ) ; if ( this . getScreenFieldView ( ) . getControl ( ) != null ) this . getScreenFieldView ( ) . setComponentState ( this . getScreenFieldView ( ) . getControl ( ) , objValue ) ; ...
Move the field s value to the control .
15,143
public void setupControlDesc ( ) { if ( m_screenParent == null ) return ; String strDisplay = m_converterField . getFieldDesc ( ) ; if ( ( strDisplay != null ) && ( strDisplay . length ( ) > 0 ) ) { ScreenLocation descLocation = m_screenParent . getNextLocation ( ScreenConstants . FIELD_DESC , ScreenConstants . DONT_SE...
Create the description for this control .
15,144
public void printScreen ( PrintWriter out , ResourceBundle reg ) throws DBException { this . getScreenFieldView ( ) . printScreen ( out , reg ) ; }
Display the result in html table format .
15,145
public String getInputType ( String strViewType ) { if ( strViewType == null ) strViewType = this . getParentScreen ( ) . getViewFactory ( ) . getViewSubpackage ( ) ; BaseField field = null ; if ( this . getConverter ( ) != null ) field = ( BaseField ) this . getConverter ( ) . getField ( ) ; String strFieldType = "tex...
Get the rich text type for this control .
15,146
public InputStream sendMessage ( Properties args , int method ) throws IOException { if ( method == GET ) { URL url = new URL ( servlet . toExternalForm ( ) + "?" + toEncodedString ( args ) ) ; return url . openStream ( ) ; } else { URLConnection conn = servlet . openConnection ( ) ; conn . setDoOutput ( true ) ; conn ...
Send the request . Return the input stream with the response if the request succeeds .
15,147
public String toEncodedString ( Properties args ) { StringBuffer sb = new StringBuffer ( ) ; try { if ( args != null ) { String sep = "" ; Enumeration < ? > names = args . propertyNames ( ) ; while ( names . hasMoreElements ( ) ) { String name = ( String ) names . nextElement ( ) ; sb . append ( sep ) . append ( URLEnc...
Encode the arguments in the property set as a URL - encoded string . Multiple name = value pairs are separated by ampersands .
15,148
public Converter getTargetField ( Record record ) { if ( record == null ) { BaseTable currentTable = m_recMerge . getTable ( ) . getCurrentTable ( ) ; if ( currentTable == null ) currentTable = m_recMerge . getTable ( ) ; record = currentTable . getRecord ( ) ; } Converter field = null ; if ( fieldName != null ) field ...
Get the target field in this record .
15,149
protected void writeToOutput ( final Map < String , Object > row ) throws IOException { if ( writer == null ) { CsvMapper mapper = new CsvMapper ( ) ; mapper . disable ( SerializationFeature . CLOSE_CLOSEABLE ) ; mapper . getFactory ( ) . configure ( JsonGenerator . Feature . AUTO_CLOSE_TARGET , false ) ; CsvSchema sch...
Write a row to the destination .
15,150
public CsvSchema buildCsvSchema ( final Map < String , Object > row ) { CsvSchema . Builder builder = CsvSchema . builder ( ) ; Set < String > fields = row . keySet ( ) ; for ( String field : fields ) { builder . addColumn ( field ) ; } return builder . build ( ) ; }
Extrapolate the CSV columns from the row keys .
15,151
public int getMaxToClaim ( int nodeCount ) { synchronized ( cluster . allWorkUnits ) { final int total = cluster . allWorkUnits . size ( ) ; if ( total <= 1 ) { return total ; } return ( int ) Math . ceil ( total / ( double ) nodeCount ) ; } }
Determines the maximum number of work units the policy should attempt to claim .
15,152
public static double integral ( DoubleUnaryOperator f , double x1 , double x2 , int points ) { double delta = ( x2 - x1 ) / points ; double delta2 = delta / 2.0 ; double sum = 0 ; double y1 = f . applyAsDouble ( x1 ) ; double y2 ; for ( int ii = 1 ; ii <= points ; ii ++ ) { x1 += delta ; y2 = f . applyAsDouble ( x1 ) ;...
Returns numerical integral between x1 and x2
15,153
public static DoubleBinaryOperator dx ( DoubleBinaryOperator f ) { return ( x , y ) -> { double h = x != 0.0 ? SQRT_EPSILON * x : SQRT_EPSILON ; double h2 = 2.0 * h ; double y1 = - f . applyAsDouble ( x + h2 , y ) ; double y2 = 8.0 * f . applyAsDouble ( x + h , y ) ; double y3 = - 8.0 * f . applyAsDouble ( x - h , y ) ...
Return partial derivative x
15,154
public static DoubleBinaryMatrix gradient ( DoubleTransform t ) { return new DoubleBinaryMatrix ( 2 , MoreMath . dx ( t . fx ( ) ) , MoreMath . dy ( t . fx ( ) ) , MoreMath . dx ( t . fy ( ) ) , MoreMath . dy ( t . fy ( ) ) ) ; }
Returns Jacobian matrix
15,155
public < T > T asObject ( String string , Class < T > valueType ) { if ( string . isEmpty ( ) ) return null ; try { return ( T ) Classes . forName ( string ) ; } catch ( NoSuchBeingException e ) { log . warn ( "Class |%s| not found. Class converter force return value to null." , string ) ; return null ; } }
Return the Java class instance for given canonical name . If given string is empty returns null . If class not found warn to logger and also returns null .
15,156
public String asString ( Object object ) { assert object != null ; assert object instanceof Class ; return ( ( Class < ? > ) object ) . getCanonicalName ( ) ; }
Get string representation for given Java class instance . Return class canonical name .
15,157
public void setupDisplaySFields ( ) { new SCannedBox ( this . getNextLocation ( ScreenConstants . RIGHT_OF_LAST_BUTTON_WITH_GAP , ScreenConstants . SET_ANCHOR ) , this , null , ScreenConstants . DEFAULT_DISPLAY , MenuConstants . FORMLINK ) ; }
Controls for a display screen .
15,158
public void setupFields ( ) { FieldInfo field = null ; for ( int iFieldSeq = DBConstants . MAIN_FIELD ; iFieldSeq < 256 ; iFieldSeq ++ ) { field = this . setupField ( iFieldSeq ) ; if ( field == null ) break ; } }
Set up all the fields for this record .
15,159
public void setupKeys ( ) { KeyArea keyArea = null ; for ( int iKeyArea = DBConstants . MAIN_KEY_FIELD ; iKeyArea < 64 ; iKeyArea ++ ) { keyArea = this . setupKey ( iKeyArea ) ; if ( keyArea == null ) break ; } }
Set up all the key areas for this record .
15,160
public void doAddListener ( BaseListener listener ) { if ( m_listener != null ) m_listener . doAddListener ( ( FileListener ) listener ) ; else m_listener = ( FileListener ) listener ; boolean bOldState = listener . setEnabledListener ( false ) ; listener . setOwner ( this ) ; listener . setEnabledListener ( bOldState ...
Internal method to add a listener to the end of the chain . Sets the listener s owner to this .
15,161
public void removeListener ( BaseListener theBehavior , boolean bFreeBehavior ) { if ( m_listener != null ) { if ( m_listener == theBehavior ) { m_listener = ( FileListener ) theBehavior . getNextListener ( ) ; theBehavior . unlink ( bFreeBehavior ) ; } else m_listener . removeListener ( theBehavior , bFreeBehavior ) ;...
Remove a listener from the chain .
15,162
public Object [ ] setEnableNonFilter ( Object [ ] rgobjEnable , boolean bHasNext , boolean bBreak , boolean bAfterRequery , boolean bSelectEOF , boolean bFieldListeners ) { boolean bEnable = ( rgobjEnable == null ) ? false : true ; if ( bFieldListeners ) { if ( rgobjEnable == null ) rgobjEnable = this . setEnableFieldL...
Enable or Disable non - filter listeners for this record .
15,163
public Object [ ] setEnableFieldListeners ( boolean bEnable ) { int iFieldCount = this . getFieldCount ( ) ; Object [ ] rgobjEnabledFields = new Object [ iFieldCount ] ; for ( int i = 0 ; i < iFieldCount ; i ++ ) { BaseField field = this . getField ( i ) ; rgobjEnabledFields [ i ] = field . setEnableListeners ( bEnable...
Enable or Disable all the field listeners and return the original state .
15,164
public void setEnableFieldListeners ( Object [ ] rgobjEnabledFields ) { for ( int i = 0 ; i < this . getFieldCount ( ) ; i ++ ) { this . getField ( i ) . setEnableListeners ( ( boolean [ ] ) rgobjEnabledFields [ i ] ) ; } }
Enable all the field listeners in this record according to this map .
15,165
public static final String formatTableNames ( String strTableNames , boolean bAddQuotes ) { if ( bAddQuotes ) if ( strTableNames . indexOf ( ' ' ) != - 1 ) strTableNames = BaseField . addQuotes ( strTableNames , DBConstants . SQL_START_QUOTE , DBConstants . SQL_END_QUOTE ) ; return strTableNames ; }
Utility routine to add quotes to a string if the string contains a space .
15,166
public BaseTable getTable ( ) { BaseTable table = ( BaseTable ) super . getTable ( ) ; if ( table == null ) { DatabaseOwner databaseOwner = null ; if ( this . getRecordOwner ( ) != null ) databaseOwner = this . getRecordOwner ( ) . getDatabaseOwner ( ) ; if ( databaseOwner != null ) { BaseDatabase database = ( BaseData...
Get the table for this record . This is the same as getFieldTable but casts the class up .
15,167
public int getFieldSeq ( String fieldName ) { for ( int i = 0 ; i < this . getFieldCount ( ) ; i ++ ) { if ( fieldName . equals ( this . getField ( i ) . getFieldName ( ) ) ) return i ; } return - 1 ; }
Get the field sequence for this field .
15,168
public String getDefaultScreenKeyArea ( ) { for ( int i = DBConstants . MAIN_KEY_AREA ; i < this . getKeyAreaCount ( ) ; i ++ ) { if ( this . getKeyArea ( i ) . getUniqueKeyCode ( ) == DBConstants . NOT_UNIQUE ) if ( this . getKeyArea ( i ) . getKeyField ( DBConstants . MAIN_KEY_FIELD ) . getField ( DBConstants . FILE_...
Get the default key index for grid screens . The default key area for grid screens is the first non - unique key that is a string . Override this to supply a different key area .
15,169
public Record getRecord ( String strFileName ) { boolean bAddQuotes = false ; if ( strFileName . length ( ) > 0 ) if ( strFileName . charAt ( 0 ) == '\"' ) bAddQuotes = true ; if ( this . getTableNames ( bAddQuotes ) . equals ( strFileName ) ) return this ; return null ; }
Get the record with this file name . This is more usefull in the queryrecord .
15,170
public RecordOwner findRecordOwner ( ) { RecordOwner recordOwner = this . getRecordOwner ( ) ; if ( recordOwner instanceof org . jbundle . base . db . shared . FakeRecordOwner ) recordOwner = null ; BaseListener listener = this . getListener ( ) ; while ( ( recordOwner == null ) && ( listener != null ) ) { BaseListener...
Get a recordowner from this record . This method does a deep search using the listeners and the database connections to find a recordowner .
15,171
public boolean isAllSelected ( ) { boolean bAllSelected = true ; for ( int iFieldSeq = DBConstants . MAIN_FIELD ; iFieldSeq <= this . getFieldCount ( ) + DBConstants . MAIN_FIELD - 1 ; iFieldSeq ++ ) { if ( this . getField ( iFieldSeq ) . isSelected ( ) == false ) bAllSelected = false ; } return bAllSelected ; }
Are all the fields selected?
15,172
public String getSQLQuery ( boolean bUseCurrentValues , Vector < BaseField > vParamList ) { String strRecordset = this . makeTableNames ( false ) ; String strFields = this . getSQLFields ( DBConstants . SQL_SELECT_TYPE , bUseCurrentValues ) ; boolean bIsQueryRecord = this . isQueryRecord ( ) ; String strSortParams = th...
Get the SQL SELECT string .
15,173
public String getSQLSeek ( String strSeekSign , boolean bUseCurrentValues , Vector < BaseField > vParamList ) { boolean bIsQueryRecord = this . isQueryRecord ( ) ; String strRecordset = this . makeTableNames ( false ) ; String strFields = this . getSQLFields ( DBConstants . SQL_SELECT_TYPE , bUseCurrentValues ) ; Strin...
Get the SQL Seek string .
15,174
public String getSQLUpdate ( boolean bUseCurrentValues ) { String strRecordset = this . getBaseRecord ( ) . makeTableNames ( false ) ; KeyArea keyArea = this . getBaseRecord ( ) . getKeyArea ( 0 ) ; boolean bUseCurrentKeyValues = bUseCurrentValues ? true : keyArea . isNull ( DBConstants . TEMP_KEY_AREA , true ) ; boole...
Get the SQL Update string . UPDATE table SET field1 = value1 field2 = value2 WHERE key = value
15,175
public String getSQLDelete ( boolean bUseCurrentValues ) { String strRecordset = this . getBaseRecord ( ) . makeTableNames ( false ) ; KeyArea keyArea = this . getKeyArea ( 0 ) ; boolean bIsQueryRecord = this . isQueryRecord ( ) ; boolean bUseCurrentKeyValues = bUseCurrentValues ? true : keyArea . isNull ( DBConstants ...
Get the SQL Delete string . DELETE table WHERE key = value ;
15,176
public void handleInitialKey ( ) { KeyArea keyArea = this . getKeyArea ( - 1 ) ; if ( keyArea == null ) return ; BaseBuffer buffer = new VectorBuffer ( null ) ; boolean [ ] rgbModified = keyArea . getModified ( ) ; boolean [ ] rgbNullable = keyArea . setNullable ( true ) ; keyArea . setupKeyBuffer ( buffer , DBConstant...
The initial key position is in this record ... Save it!
15,177
public void handleEndKey ( ) { KeyArea keyArea = this . getKeyArea ( - 1 ) ; if ( keyArea == null ) return ; BaseBuffer buffer = new VectorBuffer ( null ) ; boolean [ ] rgbModified = keyArea . getModified ( ) ; boolean [ ] rgbNullable = keyArea . setNullable ( true ) ; keyArea . setupKeyBuffer ( buffer , DBConstants . ...
The end key position is in this record ... Save it!
15,178
public boolean handleLocalCriteria ( StringBuffer strFilter , boolean bIncludeFileName , Vector < BaseField > vParamList ) { BaseListener nextListener = this . getNextEnabledListener ( ) ; boolean bDontSkip = true ; if ( nextListener != null ) bDontSkip = ( ( FileListener ) nextListener ) . doLocalCriteria ( strFilter ...
Check to see if this record should be skipped . Generally you use a remote criteria .
15,179
public boolean handleRemoteCriteria ( StringBuffer strFilter , boolean bIncludeFileName , Vector < BaseField > vParamList ) { BaseListener nextListener = this . getNextEnabledListener ( ) ; if ( nextListener != null ) return ( ( FileListener ) nextListener ) . doRemoteCriteria ( strFilter , bIncludeFileName , vParamLis...
Check to see if this record should be skipped .
15,180
public boolean isModified ( boolean bNonKeyOnly ) { int fieldCount = this . getFieldCount ( ) ; for ( int fieldSeq = DBConstants . MAIN_FIELD ; fieldSeq < fieldCount + DBConstants . MAIN_FIELD ; fieldSeq ++ ) { BaseField field = this . getField ( fieldSeq ) ; if ( field . isModified ( ) ) if ( ! field . isVirtual ( ) )...
Have any fields Changed?
15,181
public void setModified ( boolean [ ] rgbModified ) { int iFieldCount = this . getFieldCount ( ) ; for ( int iFieldSeq = DBConstants . MAIN_FIELD ; iFieldSeq < iFieldCount + DBConstants . MAIN_FIELD ; iFieldSeq ++ ) { BaseField field = this . getField ( iFieldSeq ) ; if ( iFieldSeq < rgbModified . length ) field . setM...
Restore the field s modified status to this .
15,182
public boolean isNull ( ) { int fieldCount = this . getFieldCount ( ) ; for ( int fieldSeq = DBConstants . MAIN_FIELD ; fieldSeq < fieldCount + DBConstants . MAIN_FIELD ; fieldSeq ++ ) { BaseField field = this . getField ( fieldSeq ) ; if ( ( ! field . isNullable ( ) ) && ( field . isNull ( ) ) ) return true ; } return...
Are there any null fields which can t be null?
15,183
public void addDependentScreen ( ScreenParent screen ) { if ( m_depScreens == null ) m_depScreens = new Vector < ScreenParent > ( ) ; m_depScreens . addElement ( screen ) ; screen . setDependentQuery ( this ) ; }
Add another screen dependent on this record . If this record is closed so is the dependent screen .
15,184
public void removeDependentScreen ( ScreenParent screen ) { if ( m_depScreens == null ) return ; if ( m_depScreens . contains ( screen ) ) m_depScreens . removeElement ( screen ) ; screen . setDependentQuery ( null ) ; }
Remove a dependent screen .
15,185
public FieldInfo getCounterField ( ) { KeyArea keyArea = this . getKeyArea ( DBConstants . MAIN_KEY_AREA ) ; if ( keyArea != null ) { BaseField fldID = keyArea . getKeyField ( DBConstants . MAIN_KEY_FIELD ) . getField ( DBConstants . FILE_KEY_AREA ) ; if ( fldID instanceof CounterField ) return ( CounterField ) fldID ;...
Get the autosequence field if it exists .
15,186
public boolean moveFields ( Record recSource , ResourceBundle resource , boolean bDisplayOption , int iMoveMode , boolean bAllowFieldChange , boolean bOnlyModifiedFields , boolean bMoveModifiedState , boolean syncSelection ) { boolean bFieldsMoved = false ; for ( int iFieldSeq = 0 ; iFieldSeq < this . getFieldCount ( )...
Copy all the fields from one record to another .
15,187
public void selectScreenFields ( ) { if ( this . isOpen ( ) ) return ; { } Record recordBase = this . getBaseRecord ( ) ; if ( recordBase != null ) { for ( int iIndex = DBConstants . MAIN_FIELD ; iIndex < recordBase . getFieldCount ( ) ; iIndex ++ ) { boolean bSelect = false ; BaseField field = recordBase . getField ( ...
Optimize the query by only selecting the fields which are being displayed .
15,188
public boolean checkAndHandleFieldChanges ( BaseBuffer buffer , boolean [ ] rgbModified , boolean bRestoreVirtualFields ) { boolean bAnyChanged = false ; buffer . resetPosition ( ) ; for ( int iFieldSeq = 0 ; iFieldSeq < this . getFieldCount ( ) ; iFieldSeq ++ ) { BaseField field = this . getField ( iFieldSeq ) ; Objec...
Compare the current state with the way the record was before and call any fieldchange listeners .
15,189
public int getCodeKeyArea ( ) { int iTargetKeyArea = 0 ; for ( int i = this . getKeyAreaCount ( ) - 1 ; i >= 0 ; i -- ) { KeyArea keyArea = this . getKeyArea ( i ) ; if ( keyArea . getUniqueKeyCode ( ) == DBConstants . SECONDARY_KEY ) iTargetKeyArea = i ; if ( iTargetKeyArea == 0 ) if ( keyArea . getUniqueKeyCode ( ) =...
Get the code key area .
15,190
public boolean populateThinTable ( FieldList fieldList , boolean bApplyMappedFilter ) { Record record = this ; if ( bApplyMappedFilter ) record = this . applyMappedFilter ( ) ; if ( record == null ) return false ; FieldTable table = fieldList . getTable ( ) ; boolean bAutoSequence = fieldList . isAutoSequence ( ) ; boo...
Utility to copy this entire table to this thin table .
15,191
public final void copyAllFields ( Record record , FieldList fieldList ) { for ( int i = 0 ; i < fieldList . getFieldCount ( ) ; i ++ ) { FieldInfo fieldInfo = fieldList . getField ( i ) ; BaseField field = record . getField ( i ) ; this . moveFieldToThin ( fieldInfo , field , record ) ; } }
Copy the data in this record to the thin version .
15,192
public void moveFieldToThin ( FieldInfo fieldInfo , BaseField field , Record record ) { if ( ( field == null ) || ( ! field . getFieldName ( ) . equals ( fieldInfo . getFieldName ( ) ) ) ) { field = null ; if ( record != null ) field = record . getField ( fieldInfo . getFieldName ( ) ) ; } if ( field != null ) { if ( f...
Move the data in this record to the thin version .
15,193
private static String [ ] tokenize ( String string ) { if ( string . indexOf ( "?" ) == - 1 && string . indexOf ( "*" ) == - 1 ) { return new String [ ] { string } ; } char [ ] textArray = string . toCharArray ( ) ; List < String > tokens = new ArrayList < String > ( ) ; StringBuilder tokenBuilder = new StringBuilder (...
Splits a string into a number of tokens .
15,194
public void setProduct ( final String product ) { if ( product == null && this . product == null ) { return ; } else if ( product == null ) { removeChild ( this . product ) ; this . product = null ; } else if ( this . product == null ) { this . product = new KeyValueNode < String > ( CommonConstants . CS_PRODUCT_TITLE ...
Sets the name of the product that the Content Specification documents .
15,195
public void setVersion ( final String version ) { if ( version == null && this . version == null ) { return ; } else if ( version == null ) { removeChild ( this . version ) ; this . version = null ; } else if ( this . version == null ) { this . version = new KeyValueNode < String > ( CommonConstants . CS_VERSION_TITLE ...
Set the version of the product that the Content Specification documents .
15,196
public void setBrand ( final String brand ) { if ( brand == null && this . brand == null ) { return ; } else if ( brand == null ) { removeChild ( this . brand ) ; this . brand = null ; } else if ( this . brand == null ) { this . brand = new KeyValueNode < String > ( CommonConstants . CS_BRAND_TITLE , brand ) ; appendCh...
Set the brand of the product that the Content Specification documents .
15,197
public void setId ( final Integer id ) { if ( id == null && this . id == null ) { return ; } else if ( id == null ) { removeChild ( this . id ) ; this . id = null ; } else if ( this . id == null ) { this . id = new KeyValueNode < Integer > ( CommonConstants . CS_ID_TITLE , id ) ; nodes . addFirst ( this . id ) ; if ( t...
Sets the ID of the Content Specification .
15,198
public void setTitle ( final String title ) { if ( title == null && this . title == null ) { return ; } else if ( title == null ) { removeChild ( this . title ) ; this . title = null ; } else if ( this . title == null ) { this . title = new KeyValueNode < String > ( CommonConstants . CS_TITLE_TITLE , title ) ; appendCh...
Sets the Content Specifications title .
15,199
public void setSubtitle ( final String subtitle ) { if ( subtitle == null && this . subtitle == null ) { return ; } else if ( subtitle == null ) { removeChild ( this . subtitle ) ; this . subtitle = null ; } else if ( this . subtitle == null ) { this . subtitle = new KeyValueNode < String > ( CommonConstants . CS_SUBTI...
Sets the Subtitle for the Content Specification