Row level validations for JTable

Is their a way to validate the row data of a editable JTable before moving out from that row, and if invalid data existings in that row then we need to display an error message and set the focus back to that row.
Basically the user should not be able to move out from that row until he enters valid data for the row.
I was able to do the validations at the cell level, by validating in the editor of that particular cell or in the SetValueAt() method. The reason i need the row level validations are for example if a required cell is left blank(if we don't tab into the cell then nor the editor is started nor the setValueAt() is called to do the validations) or if a cell's validation depends on the other cell's value in the same row.
I can over write the valueChanged() method of the Jtable itself to trap the row change event. But the valueChanged() method only does the repainting for the new selection, the selectedRow index is changed even before the valueChanged is called. So in the valueChanged() method the selectedRow index is the row to which u are moving into rather than the row from which u are moving out and this is the row u need validations for. ListSelectionEvent has two methods getFirstIndex() and getLastIndex(), one among these two will return the row number from which u are moving out from, so based on this i can validate the row iam moving out from and set the focus back to that row if invalid data exists.(The valueChanged event is fired again when u are resetting back the focus).
But the problem is when the row u are moving into and the row u are moving out from both have invalid data. Then it becomes an infinite loop as the valueChanged event is fired when u are setting back the focus.
Any Suggestions ?
Thanks

DrClap:
i need a editable JTable. so ur suggestion doesn't work.
Jaredth :
here is the code. I have over rided valueChanged method of JTable and called my validateRow in this method. I am just displaying a error msg for now, iam not setting the focus back to the row which has invalidate data. This code doestn't work for cases where when the row u are moving into and the row u are moving out from both have invalid data.
public void valueChanged(ListSelectionEvent e){
if( this.getSelectedRow() == -1) return;
if(!e.getValueIsAdjusting() ) {
int selRow = this.getSelectedRow();
int firstIndex = e.getFirstIndex();
int lastIndex = e.getLastIndex();
int rowToValidate = selRow == lastIndex ? firstIndex : lastIndex;
if( !isValidateRow( rowToValidate) ){
JOptionPane.showMessageDialog(null,"Invalid Data at row: "+rowToValidate,
"Row validation failed", JOptionPane.ERROR_MESSAGE);
return;
kenny_lee:
I have already done what u explained above. This works fine for cases where u need to validate individual cells in a row. But what happens when the validation of a cell in a row depends on the value in a different cell in the same row and for which u didn't enter any value yet. So in these cases u need to do the validation when u are moving out from the row. So i need to know is their a way to handle this in a efficient way? There is a way by over loading the valueChanged method of the JTable as mentioned above but it will not work for cases where the row u are moving into and the row u are moving out from both have invalid data.
Thanks for ur response.
Let me know if u find a solution to this problem

Similar Messages

  • Row level validation for Master-Detail form

    OA JDeveloper 9i (RUP5) 9.0.3.5 (Build 1453)
    I have a form which is based on a master detail relationship.
    - For each employees details (Advancetable) based on a EO (AbsenceInputsEO)
    - For each employee you can add one or more allowances records (AdvanceTable) VO (AbsenceInputsVO)
    Both the above VO and EO is based on the same table (XHR_BWCD_KRONOS_INTERFACE)
    How do stop a user from selecting (radio button) the next employee in an advance table (master level), it the the records they entered at the detail level for the previous employee is not valid?
    I used the the same validation method I used for the "APPLY" event to validate the records entered at detail level
    to the "EmployeeSelect" event, but the error message showed only after the new employee has been selected. Thus the error message that is displayed does not relate to the employee record selected at that stage.
    How do I prevent the user from selecting the next employee in the Master(Advancetable) if the records in the Detail(AdvanceTable) is not valid?

    Thanks for you help,
    Where able to reset the "SelectFlag" for the employee the error related to, but now I endup with two radio buttons being selected. One for the employee which the error relates to and one for the employee which triggered the validation when user navigated away from the current employee record.
    I need to be able to set the attribute "SelectFlag" for any other employee selected in the master record to "N", before the error is thrown. I do not seem to be able to access the newly selected employee record to set the "SelectFlag" to "N" as I only have access to the currentrow SelectFlag in the processFormData.
    It looks to be if I can only access the new selected employee in the processFormRequest(OAPageContext pageContext, OAWebBean webBean), but I never get to this method as the error message stop processing in the processFormData().
    I have the following code in the processFormData(OAPageContext pageContext, OAWebBean webBean)
    if ("EmployeeSelect".equals(event))
    if (!IsValid(pageContext,am,true,AsgJobName,EmpStartDate.toString()))
    // oracle.jbo.Row ValidationRow = vo.getFirstFilteredRow("SelectFlag", "Y");
    // Set flag for employee record with error
    Row [] rows = vo.getFilteredRows("SelectFlag", "Y");
    // getFilteredRows returns a zero-length array if it finds no matches.
    if ((rows != null) && (rows.length > 0))
    // Set the master row and get the unique identifier.
    Row masterRow = rows[0];
    am.findViewObject("EmployeeAbsenceDetailsVO1").getCurrentRow().setAttribute("SelectFlag","Y");
    vo.setCurrentRow(masterRow);
    // Unselect new Employee
    throw new OAException(ErrorMessage, OARowValException.ERROR);
    } // EmployeeSelect-Event
    Question:
    =======
    Can I access the newly selected employee rows from the processFormData to reset the "SelectFlag" to "N" before I through the error message? I would like to be able to do this in the section I have marked "// ?????", before I throw the error. How would I do this?

  • OA JDeveloper 9i (RUP5) 9.0.3.5 (Build 1453) - Row level validation issue

    Hi everyone,
    Can anyone help me with the following:
    Version of OA JDeveloper 9i (RUP5) 9.0.3.5 (Build 1453)
    I have a xml page what is based on a master detail relationship.
    The master table (Advancetable EO) contain the Employee details and the Detail VO (Advancetable) contain
    the allowances an employee are entitiled too.
    How do I stop a user from selecting(radio button) the next employee in an advance table, it the the records
    they entered at the detail level is not valid. (Row level validation). My validation method works fine then they try commit the record.
    But I need to stop them from navigating to the next employee record in the table, when the records they entered
    at detail level is not valid.
    How will I do this?
    I added the same validation method I used for the "APPLY" event to validate the records entered at detail level to the "EmployeeSelect" event, but the error message showed only after the new employee has been selected. Thus the error message that is displayed does not relate the the employee record selected at that stage.

    Time for you to make a trip to the [url http://forums.oracle.com/forums/forum.jspa?forumID=210]OA Framework Forum

  • Row level Security for BI Author Role

    Hi All,
    We are using OBIEE 11.1.1.5 in our project. We have a requirement where we need to configure row level security on certain column.
    We are currently using external table and session variable approach to configure this. This security works fine for the users with BI Consumer
    roles. But we are facing issue with configuring row level security for BI Author role.
    BI Author can create any analysis in BI Answers and suppose he/she creates a report which does not contain the column on which row level
    security is applied than he can see all the data. For eg.
    We have one dimension Products having two levels Product Division and Brand. I want to configure security based on Product Division column.
    But if BI Author create a report with only Brand and Measures than row level security is not working.
    Does anyone has face this issue before.
    Please let me know if you want any other information from my side.
    Regards,
    Vikas

    If you are using a multidimensional cube you can use the "permit" command to control access to dimension members or provide cell level security within the cube. The OLAP database documentation provides on how to use the PERMIT command.
    If you are using relational tables and/or views with additional CWM metadata mapped using OEM then you need to refer to the database documentation relating to Virtual Private Databases and Label Security
    Business Intelligence Beans Product Management Team
    Oracle Corporation

  • Field level validations for an Infotype

    Hi,
    Can anybody tell me if  field level validations can be done for each and every field in a HR infotype?
    Thank you.

    You can do most of the validations using the Infotype User exit ZXPADU02 or the AFTER_INPUT mrthod in the BAdI HRPAD00INFTY.
    But each & every field  -- NO
    ~Suresh

  • Column validation for JTable?

    Hi all,
    i have a table on my app, there is a column that show boolean value on the table. it's represented by check box, cause i'm using a custom table model. the datas is took from database.
    i want to create a column validation to validate at least only 1 cell must checked, if there's only a checkbox that checked and when we try to uncheck the last one it will show us a warning. how to make it possible?
    anyone can help me?
    ps:
    i'm using jdk1.6.0_04

    You will probably need to create a custom editor.
    This code shows how to create one using a text field. The code will be similiar for a check box:
    http://forum.java.sun.com/thread.jspa?forumID=57&threadID=642364
    You will need access to the JTable or TableModel and would need to look at the values in every row for the specific column before determining whether to stop editing or not.

  • Row Level Security for INSERT's

    Hello there,
    I implemented security-policies for the actions SELECT, UPDATE, DELETE and INSERT. All policies work well with exemption to the INSERT-policy. My question is:
    How does the dynamic predicate work for INSERT-actions?
    As far as I learned, a command like "SELECT ... FROM ..." is extended by a "WHERE " + predicate (from policy). But does this work with INSERT? I mean does something like "INSERT INTO Testtable VALUES(....)" + "WHERE " + predicate work? Am I constructing my predicate wrong or does RLS not work in this case?
    Regards
    Philipp Pott

    Ok, I found the answer myself:
    for INSERT's and UPDATE's the "update_check"-option of the DBMS_RLS.ADD_POLICY procedure (see PL/SQL Supplied Packages Reference, 61-5) is applicable. Setting this value to TRUE will let the server run the policy also after the insert.
    With running the policy after the insert suddenly my routine worked and now rejects (prohibited) inserts with error ORA-28115 "Policy with check option violation".
    Unfortunately this is not mentioned or shown by an example in the Oracle documentation. I found an example in the security-corner (http://otn.oracle.com/sample_code/deploy/security/9i_security.html) and some text in a technical white-paper (http://otn.oracle.com/deploy/security/oracle9iR2/pdf/VPD9ir2twp.pdf).
    Huhh, on to the next steps / problems ..
    Regards
    Philipp

  • How to make Management of row level restrictions easy for webi reports?

    Hi all
    Our BO Product version is 12.3.0.601 (BO 3.1)
    We are applying row level security for webi reports at universe level...
    Since  Universes are more in Number we have to create same restrictions and apply it to the users lets take a restrictions on region....which is common across all universes.
    So the problem lies with the management of restrictions created at universe level.
    Can we have a setup in where we can centralized the restirctions at a place so that management would be easy ......???
    Shall we have to import the roles(restrictions) from R/3 or BW or Database level...?
    Then how we will restrict our report (webi) to a region?????
    So basically webi reports should run with the restrictions lets say region....How we will achieve this?/
    Thanks and Regards
    Ritu Raj

    Hi,
    what is your Datasource?
    If its SAP BW i would highly recommend you use the SAP Authentication in your  BOE XI 3.1 So the users log into BOE with their SAP Username and Password and than the Data restriction of your BW takes place when the users run their Reports.
    Informations on how to confiure the SAP Authentication you will find in the installation Guide of the SAP ITK.
    Regards
    -Seb.

  • How to check the row level security in TOAD for oracle

    Hi ,
    for ex, i have 2 types of users
    normal user and super user
    super user can see the group set (some column name) created by normal user
    but normal user can not see the set created by super user
    this set crestion aslso has 3 types "U','P',S'
    P & S can be viewed by even normal user
    but U should not
    so here we are having some row level security for the normal user .....
    So, in TOAD for oracle how to check that......
    Let me know if i'm not clear

    Like
    I'm the super user....
    And some records are inserted to a table by different users ('a' , 'b', etc....)
    So,if user 'a' logins then he can be able to see only the records inserted by 'a' only...
    how to see in TOAD where such type of scripts (filter conditions) are written.....

  • Detail screen for row level locking

    Hi All ,
    I have developed row level locking for a table , Next requirment is to display the details of each row i another screen when the user click on each row .And if the row which is clicked for display is geyout in first screen then it should be grey in details screen also .If the row is editable in the first screen then it should be in change mode in details screen .
    I appreciate the help and support .
    please provide the answer as soon as possbile .....
    Thanks,
    NJ

    Yes, if a process holds many row level locks on a table, those locks by default can be escalated to partition locks, and, if necessary, table locks.  Unless you are getting and holding many locks on a given table, this will not happen.
    You say you are exporting data.  If all you are doing is selecting from the table (not updating, deleting or inserting data) and you are using the read committed transaction isolation level, you would only hold a lock on a row for the small fraction
    of a second when you are actually reading it.  So you will never have large numbers of locks at one time.  If you are doing large numbers of updates, inserts, or deletes in a singletransaction or if you are doing large numbers of selects in a single
    transaction with the isolation level set to repeatable read or serializable, then it is possible to get enough locks to cause SQL server to escalate to partition or table locks.  This is normally a good thing (that's the reason Microsoft made it the default). 
    To many locks eats up memory.
    However, if you determine this is causing you a problem and you do not want the locks on a particular table ever escalated, you can use the ALTER TABLE SET (LOCK_ESCALATION = DISABLE) command to prevent most cases of lock escalation on a table by table basis. 
    See BOL for a description of the ALTER TABLE command.  However, I would recommend you not use this unless you have determined that lock escalation is causing you problems.  It is very easy to make things worse, not better by doing this.
    Tom

  • SAP Lumira - Implementing row level security

    Hi All,
    I aware that SAP Lumira 1.17 onward allows to share the datasets, stories to SAP Lumira Server as well as SAP BI Platform (4.1 SP3 onward).
    But I would like to know if there is any way of implementing Row level security for this published contents i.e. datasets or stories. e.g. If user A (may be an administrator with access to all the regions) creates dataset and story and shares it with other users over SAP Lumira Server or SAP BI Platform. But when user B accesses these contents on any platform, SAP Lumira server or SAP BI Platform, he should be able to see data only as per his access (his own region). Can something of this sort be implemented?
    Thanks,
    Abhijit

    Hi,
    Sorry for the delay in getting back to you.
    As per my understanding - as of today, we respect Row-level security when acquiring (fetching) the data from universe into Lumira desktop (also, contexts and business-security profiles i.e. columns)
    now, when that desktop user has 'designed' the Lumira document, all of the above: row-level, contexts and security profiles  are 'locked-down' into that artefact when shared onwards. (i.e. to Lum Server and hence, BI Platform)
    once this content is being access from the BI Launchpad, refresh-on-demand is possible from the story, as well as scheduling of dataset on which it is based.
    According this blog by Greg Wcislo (the product owner for the Add-on)  Lumira integration for BI4 functionality detailed. note that features such as 'refresh on open' and 'changing design-time parameters' (i.e. prompts) are not yet supported,  but very much in future scope / plans.
    I believe that one of the other mid-term goals is to architect a 'Lumira server-side universe refresh' (i.e. so that the processing is handled 100% by Lumira server) rather than querying across BIPlatform services then replicating a dataset to HANA (which is currently the process flow)
    I hope this helps.
    Regards,
    H

  • Row-level security problem using VPD

    Hi all,
    I've implemented row-level security for my application using the following procedure:
    1) Created a procedure for setting the context for the application:
    PROCEDURE set_empno
    IS
    emp_id NUMBER;
    BEGIN
    BEGIN
    SELECT empno
    INTO emp_id
    FROM SCOTT.EMP
    WHERE upper(ename) = SYS_CONTEXT('USERENV', 'SESSION_USER');
    DBMS_SESSION.SET_CONTEXT('emp_sel_context', 'empno', emp_id);
    EXCEPTION
    WHEN OTHERS THEN emp_id := 0;
    END;
    END;
    2) Created the application context:
    CREATE CONTEXT emp_sel_context USING secman.app_security_context;
    In which secman is my security schema and app_security_context is the name of above procedure package.
    3) Created a function to access the application context:
    FUNCTION emp_sec(E1 VARCHAR2, E2 VARCHAR2) RETURN VARCHAR2
    IS
    e_predicate VARCHAR2(2000);
    BEGIN
    e_predicate := 'empno = SYS_CONTEXT(''emp_sel_context'', ''empno'')';
    RETURN e_predicate;
    END;
    END;
    4) Created a logon trigger:
    CREATE OR REPLACE
    TRIGGER INIT_CONTEXT AFTER
    LOGON ON DATABASE
    BEGIN
    SECMAN.APP_SECURITY_CONTEXT.SET_EMPNO;
    END;
    5) Added a policy on scott.emp like this:
    begin
    dbms_rls.add_policy (
    object_schema => 'SCOTT',
    object_name => 'EMP',
    policy_name => 'EMP_SEL_POLICY',
    function_schema => 'SECMAN',
    policy_function => 'EMP_SECURITY.EMP_SEC',
    statement_types => 'SELECT',
    update_check => TRUE
    end;
    My problem is that when a user queries the EMP table the above procedure does not work and 'no rows selected' is returned for each user that queries the table. Does anybody know which part of my procedure is wrong?
    Any helps is really appreciated.
    S/\EE|)

    i,
    I suggest:
    create another table emp1(logon with scott),this table only include empno,ename,then insert a few record,then modify
    procedure set_empno as
    PROCEDURE set_empno
    IS
    emp_id NUMBER;
    BEGIN
    BEGIN
    SELECT empno
    INTO emp_id
    FROM SCOTT.EMP1
    WHERE upper(ename) = SYS_CONTEXT('USERENV', 'SESSION_USER');
    DBMS_SESSION.SET_CONTEXT('emp_sel_context', 'empno', emp_id);
    EXCEPTION
    WHEN OTHERS THEN emp_id := 0;
    END;
    END;
    certainly ,you should grant select on emp1 to the user who will be test.
    lixinzhu
    2007/09/17

  • Row level Security in obiee11g

    Hello
    I am trying to implement Row Level security for some 10,000 users based on the Cost Centers which are about 30,000. I know how to implement the data level security using groups an dapplication roles and creating security filters on those groups.
    But There are two issues I am facing :
    1. The no. of cost centers are huge i.e 30,000 . So creating these many groups doesn't seem feasible. Any other approach.
    2. Cost center has got level based hierarchies having 20 levels and is a ragged hierarchy. There are some users who have access to Parent level node and there are some having access to child level cost centers. What I believed that for users having access to Parent level , I can assign all the child level cost centers and teh security will rollup to provide access to the Parent node (like you have access to California and Florida so automatically you get access to US (Cal + Flo).
    But the issue is there could be one user who will have access to the TOp level so I will have to assign all teh cost center (30,000) so that he can get access to the Total Cost Centers. There could be other Managers who will have respective Parent Cost center access leading to assigning them to say 5000 - 10000 cost centers. My fact conatins the leaf level cost centers.
    Is there a better approach to handle this.

    Hi,
    You can try to model your security requirement similar to Position-Based Security in OBIA .
    Check *7.5.1 Primary Position based Security*
    http://docs.oracle.com/cd/E10783_01/doc/bi.79/e10742/security.htm
    Thanks

  • Field level Validation in SAP PI

    Hi All,
    I am integrating with a 3rd Party system (File to Proxy scenario). Source file contains around 30 fields. I was asked to do field level validations for each of this field in PI. Is this a good practice. Do we do field validation in PI Integration development? I think PI should contain more of integration logic than field level validations. Please suggest.
    Also out of all the 30 fields few are numeric, some are text and some are dates. While creating data types do I need to created all as string or based on their nature I need to use integer,date etc? Please suggest which is the best practice.
    Thanks.

    I agree with Rahul.
    Yes we can perform validation in PI (most of the cases we do by request of the Business team).
    But always have a thumb rule for your self.
    1. Check first weather the source system is capable of doing the validation at its end.
    2. If YES make sure the source system does the validations required. (I am sure most of the app would be able to the validation).
    3.If NO then accept the validation process to be done in PI end.
    One Important thing:
    What kind of validation are you taking about? i assume this is field level validation rite?
    and this is a Proxy to file scenario rite.
    I will strongly suggest you to do following things at source and receiver Business systems.
    1.gather a meeting the with the end business teams (source and receiver).
    2.Force them to create data type at their end (sorce and target)with  same data type structure- with same field length even.
    ie, if source first field is integer with maxlen25  corresponding reciver field is also integer with maxlen25, if source has char field then in reciver also its char.
    If you make both the source and reciever business to have same data type at there end, NO VALIDATION would be required to be done in PI
    also in this case you can declare all the data type as STRING in PI and pass the data to receiver system. (which has the same data type as sender).
    Regards,
    Senthilprakash.

  • Row-level security tied to a user account.

    Bear with me, I'm not quite sure I know what I'm talking about.
    Recently we migrated from BO 5.1.7 to BO XII r2 on Solaris. Under Bo 5.1.7 our Finance users tell me there was a way to attach row level security to the account itself. For example, Finance users could only access RU's which belonged to Finance. This there a way to recreate this global security level so that we don't have to do it on a case-by-case basis?
    Thank you in advance.

    You can specify row-level security for a User or UserGroup on a Universe via the Universe Designer in Tools -> Manage Security
    But that would be per Universe, and not global to Enterprise.
    Sincerely,
    Ted Ueda

Maybe you are looking for

  • How to display the contents of a 2D array which is bound to a data table

    Hi , I have a backing bean which returns me a 2D array of Strings . Now I have bound this to a data table . Something like this <h:dataTable styleClass="dataTable" id="dstable" var="dbArray" value="#{pc_MyApp.dbProperties}"> Now when I say dbArray[i]

  • Powerbook Display flaws

    I have a Powerbook 1.67Ghz that I've had since May of last year. The day I picked it up it had a stuck red pixel, which I was not too happy about but they wouldn't do anything about so I had to live with it. Recently it started developing other probl

  • Discoverer 4i Titles

    We have the early adopter 4i installed. So far, most of the things that were wrong with 3i seem to be fixed. However, I can not figure out how to Edit Title within 4i. Is this possbile?

  • How can you increase/change the font size using window.print

    We don't use BI/XML Publisher. I have a button with an URL Redirect to print. javascript:window.print(); How can I give the user the option to print with a different font or larger size or optionally to set it the same for everyone? thanks John

  • Applications are failing to Launch on my iPod touch.

    I have a second generation iPod touch with iOS 4.2.1  I recently received updates for many of my applications but now many of them won't launch. They either close out while loading up or they get to the main menu then close out if I do anything. If a