Problem with a Vector of objects.

I have a vectore that contains GItems, it needs to be traversed everytime paintComponent() is called.
GItem stores the start point, end point and drawing mode (line, rect, circle, etc).
These GItems are added to the Vector on MouseReleased using items.addElement(new GItem(sPoint, ePoint, mode))
However, when they are called by paintComponent, they all have the same value as the last line drawn ????
Heres my paintComponent, maybe you could spot my bug?
public void paintComponent(Graphics g)  {
     GItem gi;
     Point p1, p2;
     super.paintComponent(g);
     for (int i=0;i<items.size();i++)  {  //items is my Vector
     gi = (GItem)items.elementAt(i);
     p1 = gi.start;
     p2 = g1.end;
     g.drawLine(p1.x, p1.y, p2.x, p2.y)
     g.drawline(sPoint.x, sPoint.y, ePoint.x, ePoint.y);
[\code]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Thats a good point //excuse the pun
i'll try setting the mode values to see if new GItems are being created,
if they are, then the point values must all be referencing the same object
in which case ePoint.clone() should solve the problem
Thanks

Similar Messages

  • Strange Problem with a Vector wraped inside a Hashtable

    Hi all ,
    I'm having a strange problem with a Vector wraped within a Hashtable inherited Class.
    My goal is to keep the order of the elements of the Hashtable so what I did was to extend Hashtable and wrap a Vector Inside of it.
    Here is what it looks like :
    package somepackage.util;
    import java.util.Enumeration;
    import java.util.Hashtable;
    import java.util.Vector;
    public class OrderedHashTable extends Hashtable {
        private Vector index;
        /** Creates a new instance of OrderedHashTable */
        public OrderedHashTable() {      
            this.index = new Vector();
    //adds a key pair value to the HashTable and adds the key at the end of the index Vector
       public synchronized Object put(Object key,Object value){      
           index.addElement(key);
           Object obj = super.put(key,value);
           System.out.println("inside OrderedHashTable Put method index size = " + index.size());
           return obj;    
    public synchronized Object remove(Object key){
           int indx = index.indexOf(key);
           index.removeElementAt(indx);
           Object obj = super.remove(key);
           return obj;
    public synchronized Enumeration getOrderedEnumeration(){
           return index.elements();
    public synchronized Object getByIndex(int indexValue){
           Object obj1 = index.elementAt(indexValue);
           Object obj2 = super.get(obj1);      
           return obj2;
       public synchronized int indexOf(Object key){
        return index.indexOf(key);
        public synchronized int getIndexSize() {
            return index.size();
        }Everything seemed to work fine util I tried to add objects using a "for" loop such as this one :
    private synchronized void testOrderedHashTable(){
            OrderedHashTable test = new OrderedHashTable();
            for (int i = 1 ; i<15; i++){
                 System.out.println("adding Object No " + i);
                 String s = new String("string number = "+i);
                 test.put(new Integer(i),s);
                 System.out.println("-----------------------------------");
            //try to list the objects
            Enumeration e = test.getOrderedEnumeration();
            while (e.hasMoreElements()){
                Integer intObj = (Integer) e.nextElement();
                System.out.println("nextObject Number = "+ intObj);
        }Here is the console output :
    Generic/JSR179: adding Object No 1
    Generic/JSR179: inside OrderedHashTable Put method index size = 1
    Generic/JSR179: -----------------------------------
    Generic/JSR179: adding Object No 2
    Generic/JSR179: inside OrderedHashTable Put method index size = 2
    Generic/JSR179: -----------------------------------
    Generic/JSR179: adding Object No 3
    Generic/JSR179: inside OrderedHashTable Put method index size = 3
    Generic/JSR179: -----------------------------------
    Generic/JSR179: adding Object No 4
    Generic/JSR179: inside OrderedHashTable Put method index size = 4
    Generic/JSR179: -----------------------------------
    Generic/JSR179: adding Object No 5
    Generic/JSR179: inside OrderedHashTable Put method index size = 5
    Generic/JSR179: -----------------------------------
    Generic/JSR179: adding Object No 6
    Generic/JSR179: inside OrderedHashTable Put method index size = 6
    Generic/JSR179: -----------------------------------
    Generic/JSR179: adding Object No 7
    Generic/JSR179: inside OrderedHashTable Put method index size = 7
    Generic/JSR179: -----------------------------------
    Generic/JSR179: adding Object No 8
    Generic/JSR179: inside OrderedHashTable Put method index size = 8
    Generic/JSR179: -----------------------------------
    Generic/JSR179: adding Object No 9
    Generic/JSR179: inside OrderedHashTable Put method index size = 10
    Generic/JSR179: inside OrderedHashTable Put method index size = 10
    Generic/JSR179: -----------------------------------
    Generic/JSR179: adding Object No 10
    Generic/JSR179: inside OrderedHashTable Put method index size = 11
    Generic/JSR179: -----------------------------------
    Generic/JSR179: adding Object No 11
    Generic/JSR179: inside OrderedHashTable Put method index size = 12
    Generic/JSR179: -----------------------------------
    Generic/JSR179: adding Object No 12
    Generic/JSR179: inside OrderedHashTable Put method index size = 13
    Generic/JSR179: -----------------------------------
    Generic/JSR179: adding Object No 13
    Generic/JSR179: inside OrderedHashTable Put method index size = 14
    Generic/JSR179: -----------------------------------
    Generic/JSR179: adding Object No 14
    Generic/JSR179: inside OrderedHashTable Put method index size = 15
    Generic/JSR179: -----------------------------------
    Generic/JSR179: nextObject Number = 1
    Generic/JSR179: nextObject Number = 2
    Generic/JSR179: nextObject Number = 3
    Generic/JSR179: nextObject Number = 4
    Generic/JSR179: nextObject Number = 5
    Generic/JSR179: nextObject Number = 6
    Generic/JSR179: nextObject Number = 7
    Generic/JSR179: nextObject Number = 8
    Generic/JSR179: nextObject Number = 9
    Generic/JSR179: nextObject Number = 9
    Generic/JSR179: nextObject Number = 10
    Generic/JSR179: nextObject Number = 11
    Generic/JSR179: nextObject Number = 12
    Generic/JSR179: nextObject Number = 13
    Generic/JSR179: nextObject Number = 14
    You can notice that the output seems correct until the insertion of object 9.
    At this point the vector size should be 9 and the output says it is 10 elements long ...
    In the final check you can notice the 9 was inserted twice ...
    I think the problem has something to do with the automatic resizing of the vector but I'm not really sure. Mybe the resizing is done in a separate thread and the new insertion occurs before the vector is resized ... this is my best guess ...
    I also tested this in a pure J2SE evironment and I don't have the same strange behavior
    Can anybody tell me what I am doing wrong or how I could avoid this problem ?
    Thanks a lot !
    Cheers Alex

    Am i doing anything wrong?Uhm, yes. Read the API doc for addElement() and for addAll()

  • Problem with static and nonstatic objects in same code?

    Hi everyone, I am working on a project and I kept running into an odd problem where my code would compile but when I went to run the code I would get an exception. I finally narrowed my problem down to a small fragment. Here is an example.
    class Mut{
    static Mut Fido = new Mut();
    Mut Sammy = new Mut();
    public static void main(String args[]){
    This piece of code will compile but when I run it on an WindowsXP machine the JRE tells me there is an exception at line 3. If I change the code to this:
    class Mut{
    static Mut Fido = new Mut();
    static Mut Sammy = new Mut();
    public static void main(String args[]){
    The code runs fine without any problems. My question is: why can't I create a static object and a nonstatic object in the same class? Is this a certain feature of JAVA I don't understand or is this a blackbox problem with XP? Any help is appreciated. Thanks
    Vance

    Is the exception stack trace what is displayed in the command-line window? If it is here is what is displayed(This is a lot):
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    at Mut.<init>(Mut.java:3)
    C:\>
    I don't know if this is everything because the winow won't let me scroll back up to where I enterd "java Mut"
    Hope this helps.
    Message was edited by: Vance
    cell@tech

  • Problems with Java and Business Objects

    <p>Hello everybody,<br /><br />I&#39;m new in BusinessObjects/Crystal Report. Now, I have some problems with Business Objects for Java (Business Objects XI Release 2 Developer).</p><p> </p><p>1)  I create a report in the report designer. This report has a parameterfield. Before I run this report within a jsp web application I want fill the parameterfield with some values from the database. I found the following code snippet for this problem in your forum. But it don&#39;t works right, because it occurs a simple input field instead of a combo box with my database values. Where is my mistake? I need the combo box! (In debug mode I saw that the parameterfield was filled with my data!)</p><p><%@page import="com.crystaldecisions.report.web.viewer.CrystalReportViewer,com.crystaldecisions.sdk.occa.report.application.ReportClientDocument,<br />com.crystaldecisions.sdk.occa.report.application.OpenReportOptions,<br />com.crystaldecisions.sdk.occa.report.lib.ReportSDKExceptionBase,<br />java.io.IOException,<br />java.sql.Connection,<br />java.sql.DriverManager,<br />java.sql.ResultSet,<br />java.sql.SQLException,<br />java.sql.Statement,<br />java.util.Locale,<br />com.crystaldecisions.sdk.occa.report.application.DataDefController,<br />com.crystaldecisions.sdk.occa.report.data.FieldDisplayNameType,<br />com.crystaldecisions.sdk.occa.report.data.ParameterField,<br />com.crystaldecisions.sdk.occa.report.data.ParameterFieldDiscreteValue,<br />com.crystaldecisions.sdk.occa.report.data.Values,<br />com.crystaldecisions.sdk.occa.report.reportsource.IReportSource"%><%<br /><br />    try {<br /><br />        String reportName = "avoParameterfeld.rpt";<br />        ReportClientDocument clientDoc = (ReportClientDocument) session.getAttribute(reportName);<br /><br />        if (clientDoc == null) {<br />            // Report can be opened from the relative location specified in the CRConfig.xml, or the report location<br />            // tag can be removed to open the reports as Java resources or using an absolute path<br />            // (absolute path not recommended for Web applications).<br /><br />            clientDoc = new ReportClientDocument();<br />            clientDoc.setReportAppServer("inproc:jrc");<br />            // Open report<br />            clientDoc.open(reportName, OpenReportOptions._openAsReadOnly);<br /><br />             // Connection Info for fetching the resultSet<br />            String connectStr = "jdbc:oracle:thin:@it1srv19:1521:itoracle";<br />            String driverName = "oracle.jdbc.driver.OracleDriver";<br />            String userName = "user";        <br />            String password = "password";    <br /><br />            // TODO: Ensure this query is valid in your database. An exception will be thrown otherwise.<br />            String query = "SELECT DISTINCT AVONR FROM MBDEADM.AVO ORDER BY AVONR";<br />            ResultSet paramData = null;<br />           <br />            //we will now pass the resultset to the parameter to use as Default Values<br />            String parameterName = "AVONR2";<br />            int colIndex = 1; //this is the column in the ResultSet to use as the values<br />           <br />//            Load JDBC driver for the database that will be queried   <br />            Class.forName(driverName);<br /><br />            Connection connection = DriverManager.getConnection(connectStr, userName, password);<br />            Statement statement = connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE , ResultSet.CONCUR_READ_ONLY);<br />           <br />            paramData = statement.executeQuery(query);<br />           <br />            DataDefController dataDefController = clientDoc.getDataDefController();<br />           <br />            ParameterField origParamField = (ParameterField)dataDefController.getDataDefinition().getParameterFields().findField(parameterName, FieldDisplayNameType.fieldName, Locale.getDefault());<br />            ParameterField newParamField = (ParameterField)origParamField.clone(true);<br />           <br />            Values newVals = (Values)newParamField.getDefaultValues().clone(true);<br />            newVals.clear(); <br />            paramData.first();<br />            while(!paramData.isLast()){<br />                ParameterFieldDiscreteValue value = new ParameterFieldDiscreteValue();<br />                value.setValue(paramData.getObject(colIndex));<br />                newVals.add(value);<br />                paramData.next();<br />            }<br />            <br />            dataDefController.getParameterFieldController().modify(origParamField, newParamField);<br />            // Store the report document in session<br />            session.setAttribute(reportName, clientDoc);<br /><br />        }<br /><br />            // ****** BEGIN CONNECT CRYSTALREPORTPAGEVIEWER SNIPPET **************** <br />            {<br />                // Create the CrystalReportViewer object<br />                CrystalReportViewer crystalReportPageViewer = new CrystalReportViewer();<br /><br />                //    set the reportsource property of the viewer<br />                IReportSource reportSource = clientDoc.getReportSource();               <br />                crystalReportPageViewer.setReportSource(reportSource);<br /><br />                // set viewer attributes<br />                crystalReportPageViewer.setOwnPage(true);<br />                crystalReportPageViewer.setOwnForm(true);<br /><br />                // Apply the viewer preference attributes<br /><br />                // Process the report<br />                crystalReportPageViewer.processHttpRequest(request, response, application, null);<br /><br />            }<br />            // ****** END CONNECT CRYSTALREPORTPAGEVIEWER SNIPPET ****************       <br /><br />    } catch (ReportSDKExceptionBase e) {<br />        out.println(e);<br />    }<br />   <br />%><br /><br /><br /><br />2) In a other report I tried to update the data source used by the report at runtime. I used the method &#39;setDataSource(ResultSet rs, String oldTableAlias, String newTableAlias)&#39; of the &#39;DatabaseController&#39;. I got a message like this: &#39;At present in Java reporting Component does not implement&#39;. I use JRC and the docs (http://support.businessobjects.com/global/interactive/xi/om/JRC/default.html) show me this method. Is it not possible to change the data at runtime in JRC? (I tried it with the methods &#39;setDataSource(IXMLDataSet rs, String oldTableAlias, String newTableAlias)&#39;, &#39;setDataSource(Object newds)&#39;, &#39;setDataSource(IDataSet ds, String oldTableAlias, String newTableAlias)&#39;, too. But the result was the same!)<br /><br /><br /><br />3) I tried to use Business Objects in JSF framework (Ver MyFaces 1.1.3) with the same samples above. But in JSF nothing work! I got the following exception. What is my problem? Can you get me a tutorial for jsf/BusinessObjects?<br /><br />08:21:43,165 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception<br />javax.faces.FacesException: com.businessobjects.reports.sdk.JRCCommunicationAdapter<br />    at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:435)<br />    at org.apache.myfaces.application.jsp.JspTilesViewHandlerImpl.dispatch(JspTilesViewHandlerImpl.java:233)<br />    at org.apache.myfaces.application.jsp.JspTilesViewHandlerImpl.renderView(JspTilesViewHandlerImpl.java:219)<br />    at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)<br />    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)<br />    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)<br />    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)<br />    at de.itinformatik.mes.web.filter.SynchronizingFilter.doFilter(SynchronizingFilter.java:42)<br />    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)<br />    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)<br />    at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)<br />    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)<br />    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)<br />    at de.itinformatik.mes.web.ajax.aa.AAFilter.doFilter(AAFilter.java:54)<br />    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)<br />    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)<br />    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)<br />    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)<br />    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)<br />    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)<br />    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)<br />    at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)<br />    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)<br />    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)<br />    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)<br />    at
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)<br />    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)<br />    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)<br />    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)<br />    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)<br />    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)<br />    at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)<br />    at java.lang.Thread.run(Thread.java:595)<br />Caused by: java.lang.ClassCastException: com.businessobjects.reports.sdk.JRCCommunicationAdapter<br />    at com.crystaldecisions.sdk.occa.report.application.ReportClientDocumentState.saveContents(Unknown Source)<br />    at com.crystaldecisions.sdk.occa.report.application.ReportClientDocumentState.save(Unknown Source)<br />    at com.crystaldecisions.xml.serialization.XMLObjectSerializer.save(Unknown Source)<br />    at com.crystaldecisions.sdk.occa.report.application.ReportClientDocument.writeExternal(Unknown Source)<br />    at com.crystaldecisions.sdk.occa.report.application.AdvancedReportSource.writeExternal(Unknown Source)<br />    at com.crystaldecisions.sdk.occa.report.application.NonDCPAdvancedReportSource.writeExternal(Unknown Source)<br />    at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1304)<br />    at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1282)<br />    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1073)<br />    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:291)<br />    at java.util.Hashtable.writeObject(Hashtable.java:813)<br />    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br />    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)<br />    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)<br />    at java.lang.reflect.Method.invoke(Method.java:585)<br />    at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:890)<br />    at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1333)<br />    at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1284)<br />    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1073)<br />    at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1245)<br />    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1069)<br />    at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1245)<br />    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1069)<br />    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:291)<br />    at java.util.ArrayList.writeObject(ArrayList.java:569)<br />    at sun.reflect.GeneratedMethodAccessor669.invoke(Unknown Source)<br />    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)<br />    at java.lang.reflect.Method.invoke(Method.java:585)<br />    at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:890)<br />    at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1333)<br />    at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1284)<br />    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1073)<br />    at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1245)<br />    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1069)<br />    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:291)<br />    at java.util.ArrayList.writeObject(ArrayList.java:569)<br />    at sun.reflect.GeneratedMethodAccessor669.invoke(Unknown Source)<br />    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)<br />    at java.lang.reflect.Method.invoke(Method.java:585)<br />    at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:890)<br />    at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1333)<br />    at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1284)<br />    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1073)<br />    at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1245)<br />    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1069)<br />    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:291)<br />    at org.apache.myfaces.application.jsp.JspStateManagerImpl.serializeView(JspStateManagerImpl.java:590)<br />    at org.apache.myfaces.application.jsp.JspStateManagerImpl.saveSerializedViewInServletSession(JspStateManagerImpl.java:493)<br />    at org.apache.myfaces.application.jsp.JspStateManagerImpl.saveSerializedView(JspStateManagerImpl.java:332)<br />    at org.apache.myfaces.taglib.core.ViewTag.doAfterBody(ViewTag.java:122)<br />    at org.apache.jsp.testCR_jsp._jspx_meth_f_view_0(org.apache.jsp.testCR_jsp:149)<br />    at org.apache.jsp.testCR_jsp._jspService(org.apache.jsp.testCR_jsp:83)<br />    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)<br />    at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)<br />    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)<br />    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)<br />    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)<br />    at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)<br />    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)<br />    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)<br />    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)<br />    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)<br />    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)<br />    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)<br />    at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:416)<br />    ... 32 more<br /><br /><br />Thanks for your assistance <br /><br />Tosch</p>

    Which Business Objects are you referring to.
    MS .NET has a thing called Business Objects but they only work in .NET.

  • Problem with ORA-24372 invalid object for describe

    I have unresolved problem with oracle message: ORA-24372 invalid object for describe. There is the client-server application which installed on users PCs. Client application is program on Delphi 7 that installed on several users PCs which works with Oracle DB 10g server (clients on users side 8.1.7) by means ODAC 5.7. Each user by means this application works with data on Oracle server. Each group of users uses its own schema. Each of this schema has grants to select data and execute procs in the main schema. During the time of operation I modified and compiled some procs in the main schema. As the result I found some depended Invalid objects in main schema. I recompiled them. There is no invalid objects in all schemas. But when I starts application in one user place (he uses for example schema X1) I see oracle message: ORA-24372 invalid object for describe. Other users in group which uses schema X1 works without this problem. There is finite aggregate of users of schema Х1 which has this message but some users of schema Х1 has no problem. All users has identical software and there is no any invalid objects in schemas! I try to start application on my PC using schema X1 and finds ORA-24372 then I try to start application on neighbors PC and it is all ok! It happened after I recompiled main schema in the time of users operation. What should I do to resolve this problem? Where to find the source of the problem: in client or in server?

    To Mr. Sven Weller
    The purpose of creation X1 (X2, Х3…) was restriction of users to access objects in the Main Schema. X1 has no any objects except function that returns her name for internal purposes. X1 has many synonyms for objects in the Main schema. There is no invalid objects in X1!

  • Problem with Import and Base Object

    Hi everyone
    Last week, I downloaded Flash CS5. I am trying different thing and here is the problem that I dont understand
    I wrote a package like that
    package {
        import flash.text.TextField;
        import fl.controls.Button;
        public class ex1 extends Sprite {
            public function ex1() {
               var myButton:Button = new Bu
    tton();
                var label:TextField         = new TextField();
                addChild(label);
    If I try to execute that script, the compiler returns error
    1046: Type was not found or was not a compile-time constant: Button.
    1180: Call to a possibly undefined method Button.
    If I insert in the main stage (with the Componet Editor) a Button in the main stage, and recompile it, no error.
    If I delete the Button in the main stage and recompile again, no error
    But, If I save the projet and reload it again, I've got the same error
    By the way, I dont have any problem with the textField()
    What is wrong with my setup.
    OTHER QUESTION:
    If in the ACTION FRAME (F9), I insert the folowing code:
    import ex1;
    var a:ex1 = new ex1();
    one more time, I've got error from the compiler. Why ?
    We cannot include a package in the ACTION FRAME ?
    Thanks for your help

    There are some things (including $.fileName) that just do not work in jsxbin's.
    I don't thing the exception hook will work either.
    Either use an ini file in a well known location (~/Desktop) or make sure your
    files are put in Presets/Scripts. That location can be determined with this bit
    of code:
    var SCRIPTS_FOLDER =
    new Folder(app.path + '/' +
    localize("$$$/ScriptingSupport/InstalledScripts=Presets/Scripts"));
    -X

  • Problems with User Defines Mapping Objects - Dynamic Configuration

    We have a mapping object that takes data passed in from R3 and does an HTTP Post to another system using a URL and file name that is passed from the header record. We had a consultant set this up for us last year and in creating the new one we just pretty much copied what he did. The problem is, it is not working for us. We have the url and file name, we pass it to the user defined code that is supposed to pass it to the url and file name in the configuration. The java code looks like this:
    public String getPcurlOut(String pcurl,Container container){
    String ourSourceFileName = "START";
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    if (conf != null) {
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","Directory");
    conf.put(key, pcurl + ".xml");
    ourSourceFileName = conf.get(key);
    } else {
    ourSourceFileName = "conf == null";
    Basically we want to pass a url and file name to our communication channel based on values that come from our file in R3
    It is almost exactly like the one that works. Can anyone help with this?
    Thanks
    Mike
    Message was edited by:
            Michael Curtis

    Hi Michael
    <i>Basically we want to pass a url and file name to our communication channel based on values that come <b>from our file in R3</b></i>
    --> This means you have file as a sender adapter.
    Check adapter specific message properties in sender adapter.
    Please refer this blog , it is really worth.
    /people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
    Also
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","Directory")
    Try writing this as
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","<b>FileName</b>")
    Regards

  • Problems with query transport (missing object)

    Hello,
    I've a problem while transporting a query with the transport connection. I choose the option "necessary objects" but the import in the productive system fails due to a missing object.
    How can I find the missing object? In the transport log only the ID is given (e.g. " Element 67ZP0WYO09DFA52PLG2SREVBT is missing in version M")
    Thanks in advance,
    Markus

    Hi Markus,
    Check data base tables RSZELTXREF & RSZELTTXT for the missing element in the transport.
    Try to include all the missing elements of a Query in a new transport and try again.
    Hope this will help.
    Praveen

  • BW 7.3 and ECC 6.05 Problem with BI Content Activation Objects

    Hi Experts,
    I'm trying to activate the Business Content 0HE (Higher educations) and using the procedure suggested by the document "Campus BW 7 for Content Management".
    I have done what the manual indicates.
    1. Enable data sources in the source system (RSA5)
    2. I replicated the data sources in BW (replicate).
    3. I tried to activate the DSO in the Business Content.
    The problem that arises is that a large number of infobjetos not activated and show me the following error "Attribute characteristic OBJECT_NAME from CHAR_NAME not (Actively) available".
    I tried with all three types of activation 1. Before the flow 2. Only items needed 3.Before and after the flow. In either case all objects are activated.
    In my case I tried to activate the DSO "0HE_DS01."
    I've done wrong?
    What should I check?
    Thanks,
    Ramon Sulvaran

    Hi,
    If you are in R/3 4.6 or higher, or if you are in ECC 6.0, the concept is equal. maybe just options can changed.
    For the dataflow this is the same steps. the only difference is if you use V7 dataflows or V3.x dataflows. Fomr R/3 same concept.
    Regards
    Cyril

  • Problem with pasting a smart object in Photoshop

    I create artworks using both Illustrator and Photoshop by pasting different elements as smart objects in Photoshop on different layers  but I often have a problem.
    To make the pasted content  positioned exactly on the same place as in Illustrator, I create a box with no fill and stroke encompassing the whole artwork (with the thick pink frame on the image below) and paste different elements along with the encompassing box on different layers in Photoshop.
    The problem is that often during the creation of the artwork it may require using a clipping path containing objects bigger than the encompassing box. Then when pasting in Photoshop the size of the bounding box containing the invisible parts of the objects is factored in instead of the visible parts only.
    The image bolow is a simplified example. On the left side  is the selection in Illustrator but when pasted in Photoshop although it keeps the same visibility as on the left size, the encompassing frame is the bounding box shown on the right side and this messes up the position of the placed objects. I know the problem can be avoided if I know in advance how big the eventual artwork including the invisible objects would be and create an encompassing box big enough but often this is not the case. What do yo think would be the easiest way to fix this problem once it occurs?

    Just so you are aware, photoshop has a bug when sensing illustrator files.
    If your starting with a new document and letting photoshop sense the size from the clipboard, set the physical size to inches or centimeters before changing the ppi from 72 to 300. By default, photoshop is set to pixel dimentions and ppi is disabled even though you can type in a new value, it does not alter the size any.

  • Problems With Creating Group of Objects from a Collection

    Hi, please kindly help.
    I have a Collection. Its name is "activities". It is a collection of the Activity object with "color" as one of the attributes. I am writing a method and takes "activities" as a parameter (see below). The method is supposed to group "activities" by "color" and return a Collection called "activitiesGroups". And I have created an "activitiesGroup" (note: singular not plural) class with the getters and setters of all its attributes.
    I first sorted the "activities" by color. So far so good. Thereafter, I am iterating through this sorted list. If activity.getColor().trim() is tested different, I know that a new group, i.e., activitiesGroup, should be created and I should code activitiesGroups.add( activitiesGroup );Problems are:
    1. If I am at the first record of the sorted collection while iterating, I do not what to add a new group to the returned List activitiesGroups. I want to greate a new group only.
    Because "colorString" is initialized as a blank, when I code activitiesGroups.add( activitiesGroup );, I depend on that I am not at the first record of the sorted collection by testing if colorString.length(); is not a zero. I do not think it is the correct way to do it.
    What is the proper way of knowing I am at the first record of the sorted collection while iterating?
    2. I have to sum up two of the attributes of the ActivitiesGroup object: increaseToValue and decreaseToValue. While iterating, I repeat for each record within a group:
    aGroup.setIncreaseToValue( increase );
    aGroup.setDecreaseToValue( decrease ); How do I avoid the repetition?
         private Comparator colorComparator;
         private List activitiesGroups;
         private ActivitiesGroup aGroup;
         private String colorString = "";
         private String nextColorString = "";
         private BigDecimal increase;
         private BigDecimal decrease;               
         public List groupingByColor( List activities ) {
              if ( activities == null) {
                   return new ArrayList(0);
              if ( !activities.isEmpty() ) {
                   Collections.sort( activities, colorComparator);  // It works.
                   activitiesGroups = new ArrayList();
                   Iterator it = activities.iterator();
                   while ( it.hasNext() ) {
                        Activity activity = ( Activity )it.next();
                        nextColorString = activity.getColor().trim();                    
                        if ( !nextColorString.equalsIgnoreCase( colorString.trim() ) ) {
                             int length = colorString.length();
                             if ( length != 0 ) { activitiesGroups.add( aGroup ); } // Problem # 1
                             aGroup = new ActivitiesGroup();
                                                              aGroup.setColor( activity.getColor() );
                             increase = increase.add( activity.getIncreaseToValue() );
                             decrease = decrease.add( activity.getDecreaseToValue() );
                             aGroup.setIncreaseToValue( increase ); // Problem #2: repeated for every record in a group
                             aGroup.setDecreaseToValue( decrease ); // Problem #2: repeated for every record in a group
                        } else {
                            increase = increase.add( activity.getIncreaseToValue() );
                            decrease = decrease.add( activity.getDecreaseToValue() );
                            aGroup.setIncreaseToValue( increase ); // Problem #2: repeated for every record in a group
                            aGroup.setDecreaseToValue( decrease );      // Problem #2: repeated for every record in a group                         
                                                                    colorString = nextColorString;
              return activitiesGroups;
         }

    I first sorted the "activities" by color. So far so good. Thereafter, I am iterating through this sorted list. If activity.getColor().trim() is So in fact you are not dealing with an arbitrary Collection (as you stated in the first place), you are dealing with a List.
    You should know that there is a way to do this just with an iterator on an arbitrary collection - without needing to sort your list, and do it in O(n) time.

  • Problem with my Vector

    As an assignment for my computer class, I need to create a Student class that lets the user add an undefined number of grades to a Vector called grades. The user must also be able to call method getGPA( ) to return the average of all the grades.
    The problem is, I cant seem to change the object returned from grades.get (index i) to a double! I added it as a double but I have no idea how to treat it as a double again. Can someone please explain the obvious error I am making???

    (un)helpfully Java 5+ will make your double into a Double Objectfor you automatically.
    I'm loving autoboxing:
    import java.util.*;
    public class AutomatHeaven {
         public static void main(String[] args) {
              List < Integer > list = new ArrayList < Integer > ();
              //add some example data to list:
              for(int i = 0; i <= 10; ++i)
                   list.add(i);
              int total = 0;
              for(int n : list)
                   total += n;
              System.out.format("total=%d%n", total);
    }

  • Problem with iteration of Sprite objects?

    Hi all,
    I have an image on the stage, which is converted into a
    movieclip. When I click on this image, a pop-up with "Add-Note"
    hyperlink and a "Cancel_btn" appears. On clicking "Add-Note",
    allows us to enter/add a note(some text) specific to the pixel
    position(dot). A dot is a small circle(say, a dot)should
    appear(visible) on the same image at (x,y) pixel position when a
    note is added.
    Then, I need to add a Mouse_CLICK EventListener to this dot
    in such a way that, it must show some information (say, notes(viz.
    Note1,Note2,...etc.,),which contains some text information already
    entered in Text-boxes)when I click on specific dot.
    Since, dot must accept Mouse_CLICK event, I took it as a
    Sprite type of object.
    In this way I can add several dots and can handle
    Mouse_click events on a specific dot, only notes that are specific
    to the dot on which Mouse_CLICK event occured must be shown(Not all
    the notes of all the dots).
    The above explained is shown by the code attached to this topic.
    The problem is: I am unable to make visible the specific
    notes when I click on specific dot.
    So, I got struck up on visibility of specific dots for a
    specific user. I am unable to get them. Please reply me if you have
    solution to this issue.
    I will be waiting for the replies.

    Have a look at this:
    Transport connection -  cannot select infoobject (tick box)
    Regards

  • Problem with clipping and concerned objects (or rather their color)

    Greeting everyone,
    I hope i don't bother you with things that are already known or, in the end, are a product of my own stupidity ;P
    My problem is the following:
    I was working on a neat design for a list. The first version (without clipping) looked like this:
    [http://www.7pics.info/?image=GHApp-Gradient-Mobile-HowItShouldBe_2c5.jpg]
    As you can see on the bottom, the list was on top of all graphical elements.
    And because this looks stupid, i decide to simply clip the list via "clip: Rectangle{...}".
    Well... turns out it's not as easy as i hoped it would be; all of a sudden the list looks like this:
    [http://www.7pics.info/?image=GHApp-GradientProblem-Mobile-1_fb7.jpg]
    From the left to the right you see the following: first picture is what you'd see initially, from the second to the last i scrolled down one entry each (respectively moved the list up 30 pixels).
    Further scrolling down doesn't change the look, it stays like in the last picture.
    Scrolling up again delivers the same image, but in reverse order.
    The clipping seems to change something in the style of the list elements.
    To be more specific, the gradient of a single element is now applied to the whole list.
    here is a Listing
    //the group which contains the list and the clipping
    Group{
         clip: Rectangle {
              x: 0, y: 70
              width: PublicVars.screenWidth, height: 210
              fill: Color.BLACK        //which color i use doesn't change the look
         content:[
              createChoicesList()
    //create a box for each entry and add text from a string sequence "results"
    createChoicesList():Node[]{
          for(result in results){
                           singleField = Group{
                   Rectangle {
                        fill:  LinearGradient {
                             startX : 0.0
                             startY : 0.0
                             endX : 0.250
                             endY : 0.250
                             stops: [
                                  Stop {
                                       color : Color.LIGHTBLUE
                                       offset: 0.0
                                  Stop {
                                       color : PublicVars.coolGradientBlueTransparent
                                       offset: 0.5
    }I have no clue why this happens. I tried to shift some things around, thinking it had to do something with the order of some elements but... it didn't change anything.
    Another thing i noticed afterwards:
    If i run the App as a desktop program, the gradient effect is all messed up. but this time it doesn't matter if I clip the list or not:
    [http://www.7pics.info/?image=GHApp-GradientProblem-Desktop-1_d5e.jpg]
    The gradients are totally misplaced and if I scroll down they move and appear/disappear randomly across the list entries. sometimes the highlighted elements even look like this:
    [http://www.7pics.info/?image=GHApp-GradientProblem-Desktop-2_89f.jpg]
    Any Ideas?
    P.s.:
    Could it be that retrieving the resolution of a mobile device via
    "var screenWidth = java.lang.Integer.parseInt(FX.getProperty("javafx.screen.width"));"
    isn't very accurate?
    If i use the values i get from this method for the desktop application, the screen will be smaller than in the emulated mobile phone
    Edited by: Mr._Moe on 04.09.2009 21:31

    Not sure about your problem, but I can answer your last question: you can now use the [javafx.stage.Screen|http://java.sun.com/javafx/1.2/docs/api/javafx.stage/javafx.stage.Screen.html] class to get screen dimensions.

  • Problem with using multiple Entity Objects in a view Object.

    Hi
    Thank you for reading my post
    I have create 3 Business components for 3 of my database tables and now
    I must add 3 tables in a View object so i used Jdeveloper Wizard to create the View Object.
    -I Add Entity Objects which are business components to this view (In Step 2 of the Create Vview Object wizard).
    -In step 3 that I add Attributes all my attributes are marked as Transient
    Can some one explain why it happens?
    I need one of those tables to be updateable and two other tables are not updateable.
    What should should i do to achieve this?
    I should say that tables does not have any database relation (Foreign Key I Mean).
    Thanks.

    Hi user505214
    When you created your VO, on selecting the second EO, you'll note at the bottom of the same page on the wizard/editor, checkboxes for updatable or by reference. By default reference is checked and this will make your second EO's attributes transient.
    In the JDeveloper Developer's Guide for 4GL/Forms programmers, the following sections outline the difference between updatable or by reference:
    7.5 Including Reference Entities in Join View Objects
    27.9 Creating a View Object with Multiple Updatable Entities
    Make sure to read 27.9 if updatable is what you want as it indicates you may need to add some additional code.
    Hope this helps.
    CM.

Maybe you are looking for