Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9247863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:50:32+00:00 2026-06-18T09:50:32+00:00

I am using a writablelist to store dataset data the user adds to the

  • 0

I am using a writablelist to store dataset data the user adds to the application.

public class AplotDataModel  {

 IObservableList observableList = new WritableList();
 private static AplotDataModel instance = null;

 //////////////////////////////////////////////////////////////////////////
 //                         Constructor                                  //
 //////////////////////////////////////////////////////////////////////////
 private AplotDataModel() {

 }// end Constructor

 //////////////////////////////////////////////////////////////////////////
 //             SingletonSelectTable getInstance()                       //
 //////////////////////////////////////////////////////////////////////////
 public static AplotDataModel getInstance() {
    if (instance == null) {
       instance = new AplotDataModel();
  }
 return instance;
 }


 //////////////////////////////////////////////////////////////////////////
 //                              add()                                   //
 //////////////////////////////////////////////////////////////////////////
 public void add(TCComponentItemRevision tcRevision, TCComponentDataset selectedDataset) {
    AplotDatasetData pp = new AplotDatasetData(tcRevision, selectedDataset);
       if (!observableList.contains(pp)) {
          observableList.add(pp);
       }
 }

 //////////////////////////////////////////////////////////////////////////
 //                       clearTableArray()                              //
 //////////////////////////////////////////////////////////////////////////
 public void clearTableArray() {
    observableList.clear();
 }
}// End Class

In the ADD method, I am using a class to format the data to add to the writable list

AplotDatasetData pp = etc.....

Class

public class AplotDatasetData {

  TCComponentItemRevision rev;
  TCComponentDataset   componentdataset;
  String markUp = "no";

  //////////////////////////////////////////////////////////////////////////
  //                           Constructor                                //
  //////////////////////////////////////////////////////////////////////////
  public AplotDatasetData(TCComponentItemRevision tcRevision, TCComponentDataset selectedDataset) {
     rev = tcRevision;
     componentdataset = selectedDataset;

  }// end Constructor

  //////////////////////
  //   getDataset()   //
  //////////////////////
  public TCComponent getDataset() {
     return componentdataset;
  }

  //////////////////
  //   getRev()   //
  //////////////////
  public TCComponent getRev() {
     return rev;
  }

  //////////////////
  //   equals()   //
  //////////////////
  @Override
  public boolean equals(Object o) {
     AplotDatasetData p = (AplotDatasetData) o;
     if (rev.equals(p.getRev()) && componentdataset.equals(p.getDataset())) {
       return true;
      }
     else {
        return false;
      }
  }// end equals()

My code compiles – But I run a operation involving the writable list.
I get the following error.

ERROR: 11:31:00,591 – TcLogger$IC_LogListener.logging:?
org.eclipse.core.runtime – org.eclipse.ui – 0 – Unhandled event loop exception
org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.ClassCastExc
eption: org.eclipse.core.databinding.observable.list.WritableList cannot be cast
to com.lexmark.aplot.datamodels.AplotDataModel$AplotDatasetData)
etc …..

Caused by: java.lang.ClassCastException: org.eclipse.core.databinding.observable
.list.WritableList cannot be cast to com.lexmark.aplot.datamodels.AplotDataModel
$AplotDatasetData
at com.lexmark.aplot.datamodels.AplotDataModel$AplotDatasetData.equals(A
plotDataModel.java:167)

I know the issue is in the Equals method, but I am not sure how to change it, so it will work with the writable list.

EDIT

I traced the issue to this

ArrayList<AplotDataModel.AplotDatasetData> tableData = new ArrayList<AplotDataModel.AplotDatasetData>(AplotDataModel.getInstance().getObservableList());

I am trying to create a new arraylist using the data from a writablelist

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T09:50:33+00:00Added an answer on June 18, 2026 at 9:50 am

    The problem was in the Equals Method. I had to make the method more robust.

     ////////////////////
      //   hashCode()   //
      ///////////////////
      @Override
      public int hashCode() {
         final int prime = 31;
         int result = 1;
         result = prime * result + getOuterType().hashCode();
         result = prime * result
               + ((componentdataset == null) ? 0 : componentdataset.hashCode());
         result = prime * result + ((rev == null) ? 0 : rev.hashCode());
         return result;
      }
    
      ////////////////////
      //    equals()    //
      ////////////////////
      @Override
      public boolean equals(Object obj) {
         if (this == obj)
            return true;
         if (obj == null)
            return false;
         if (getClass() != obj.getClass())
            return false;
         AplotDatasetData other = (AplotDatasetData) obj;
         if (!getOuterType().equals(other.getOuterType()))
            return false;
         if (componentdataset == null) {
            if (other.componentdataset != null)
               return false;
         }
         else if (!componentdataset.equals(other.componentdataset))
            return false;
         if (rev == null) {
            if (other.rev != null)
               return false;
         }
         else if (!rev.equals(other.rev))
            return false;
         return true;
      }
    
      private AplotDataModel getOuterType() {
         return AplotDataModel.this;
      }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

using this code: Java Server side: ... out = new PrintWriter(this.client.getOutputStream(), true); ... public
I have a class with some constructors like this: public MyClass(Control caller, WritableList elements,
Using Dojo I've setup a grid which links to a data store. After the
Using Yii MVC, I want to know when a user is still on my
Using Trigger.io's barcode api in an application that only contains boilerplate HTML and the
I am using gitosis to manage a bunch of private repositories. Everything works great
using xmltextreader, how would I load a hashtable. XML: <base><user name=john>2342343</user><user name=mark>239099393</user></base> This was
Using the DateTime class, if I try to run the following code: $mydate =
Using The Play Framework how easy would it be to allow an admin user
Using the new mvc4 now gives us access to use facebook oauth otb. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.