Extending JEditorPane And Implementing Custom Attributes

I was experimenting with the following code :
class MyEditorPane extends JEditorPane
     private String str="";
     private boolean status=false;
     MyEditorPane(String str, boolean value)
          this.str=str;
          this.status=value;
     public String getString()
          return this.str;
     public boolean getStatus()
          return this.status;
}now I wanted to instantiate this class and then get the values by calling the get methods in the following manner :
MyEditorPane editor=new MyEditorPane("hii...",true);
System.out.println(editor.getString());
System.out.println(editor.getStatus());but the problem is that the instance *'editor'* doesn't seem to identify those two manually coded methods..........
can anyone please enlighten me as to what I have done wrong and is there any other way of implementing this concept of having my own attributes attached with a java component?
awaiting ur response.......

Are you getting a compile error? Or a runtime problem?
Are you sure that the MyEditorPane in the accessing code is the same MyEditorPane as in your example?
This works fine for me:
import javax.swing.JEditorPane;
class MyEditorPane extends JEditorPane {
    private String str = "";
    private boolean status = false;
    MyEditorPane(String str, boolean value) {
     this.str = str;
     this.status = value;
    public String getString() {
     return this.str;
    public boolean getStatus() {
     return this.status;
    public static void main(String[] args) {
     MyEditorPane editor = new MyEditorPane("hii...", true);
     System.out.println(editor.getString());
     System.out.println(editor.getStatus());
}Piet

Similar Messages

  • Help Pls: Create New User Form and display custom attributes +++

    Hi All,
    I am trying to create a user screen where a user would see all the organizations he is responsible for and clicking on the organization he would see the certain attribute of all the users that belong to the organization. (Kind of report)
    Account attribute need to be defined with 2 custom attributes:
    1. Organizations Responsible for
    2. Belongs to which organization.
    3. Status
    The first 2 attributes are used to define the organization heirarchy (we can't use the org heirarchy as is in IDM).
    I am just starting on the Sun IDM (very new to the product). Could you please let me know how this could be done? Which form I need to modify and any other changes I need to make.
    Thanks a lot and have a pleasant day,
    Ritesh
    PS: I know this is a long question but i really don't know how to better explain the problem.

    A workaround is to write a PL/SQL procedure to render the custom item (pass in each attribute as a paramter and then use htp.p to print it whatever format you want). You can then disable the default display of attributes (i.e. edit the style so none of the attributes are rendered).
    Hope that helps,
    Mark

  • Why extends HashMap and implements Map?

    Hi,
    I browsed the source of HashMap in JDK 5.0.
    The declaration of the class puzzled me.
    Declaration of HashMap:public class HashMap<K,V>
        extends AbstractMap<K,V>
        implements Map<K,V>, Cloneable, SerializableDeclaration of AbstractMap:public abstract class AbstractMap<K,V> implements Map<K,V>Puzzle:
    Now that AbstractMap has been declared to implement Map interface, and HashMap extends AbstractMap,
    why HashMap is declared to implement Map interface again?
    I don't think that's necessary.
    a cup of Java, cheers!
    Sha Jiang

    I don't think it makes any difference that this code is part of the standard libraryAbsolutely, I agree on the view.
    I think it was declared as such for clarity only.I just be curious with the little topic.
    "clarity" may be the answer.
    Thanks!

  • We are using extends thread and implements runnable which class first calli

    hi

    Yes, the language allows it, but your JSL quote is the 3rd edition, and Java 1.4 is based on the 2nd edition (the 2nd edition of the JSL does not go into such a deep explanation of the example shown, so thanks for that pointer). In any case, since the JSL does not address my specific issue, it is only superficially relevant (IMHO). The language allows it, but the behavior is unpredictable. I think that's what is sticking in my craw. I'm not sure what the behavior should be, but if I had to, I would propose that the behavior should not change when I change the inheritance qualifiers (again, in this particular case), but there may be other considerations.
    HibernateUtil is a snippet that can be found in the Hibernate tutorial/reference at [http://www.hibernate.org/hib_docs/v3/reference/en/html/tutorial.html|http://www.hibernate.org/hib_docs/v3/reference/en/html/tutorial.html]
    The basic idea is a cached session factory, because session factories are expensive to build. We use multiple databases, so our incarnation of HibernateUtil compares the requested database to the one in a static factory variable. If they match, that factory is used. If they don't match, the thread switches to the requested factory and creates sessions from it.
    The odd thing is that with the aforementioned inheritance "typo", it either detects that the requested database is the same as the one in the static factory (which is not true), or it returns the wrong factory (which is wrong). I want to emphasize that no other code changes were made (zero, zip, none, really, I mean it), and lots of other classes extend C1 (from the example) and they have never had this problem.

  • ADDING CUSTOM ATTRIBUTES TO PORTAL USER

    Hi,
    We are using ldap server as the EP 6.0 user database.
    We have to add few custom attributes like comanycode etc to the user.
    As I understand, the first activity will be to add these custom attributes in the ldap followed by mapping of portal logical attributes and the custom attributes in dataSourceConfiguration_xxx.xml file.
    Now what about showing these attributes in the all relevant user management screens (like Create User, Modify User etc).
    Can anyone please tell the configuration for the same.
    Any input is highly appreciated.
    regards,
    Chandra

    Hi
    Additional custom attributes can be added by editing the dataSourceConfig....xml.In this case logical to physical mapping has to be performed for each attribute.The attributes created without any mapping may be using the default namespace.
    The getArttibute() method can be used for getting the attribute values of the specified logical attribute.
    IUser user;
    String attrs[]=
    user.getAttribute("<nameSpace>","<logicalname>");
    <b>Editing the dataSourceConfig....xml for Logical to Physical mapping</b>
    Inside the nameSpace add the attribute inside the attributes tag as below.
    <nameSpace name =.........>
    <attributes>
    <attribute name = "<logicalnameyouwant>">
    </attribute>
    </attributes>
    Inside the attributeMapping specify the attribute name given above and the physicalAttribute as below
    <attributeMapping>
    <nameSpace name =.........>
    <attributes>
    <attribute name ="<logicalnameyouwant>"
    <physicalAttribute name= "<physicalnameyouwant>"/>
    </attribute>
    </attributes>
    </attributeMapping>
    Regards
    Geogi

  • Concrete classes implement abstract class and implements the interface

    I have one query..
    In java collection framework, concrete classes extend the abstract classes and implement the interface. What is the reason behind extending the class and implementing the interface when the abstract class actually claims to implement that interface?
    For example :
    Class Vector extends AbstractList and implements List ,....
    But the abstract class AbstractList implements List.. So the class Vector need not explicitly implement interface List.
    So, what is the reason behind this explicit definition...?
    If anybody knows please let me know..
    Thanx
    Rajendra.

    Why do you post this question again? You already asked this once in another thread and it has been extensively debated in that thread: http://forum.java.sun.com/thread.jsp?forum=31&thread=347682

  • Export Custom Attribute Mapping

    Hello Gurus!
    I'm migrating a xMII 11.5 project to MII 12.1 and the migration tool was fine on creating the Custom Attributes and Custom Attribute Mapping. However, what I need now is to export Custom Attribute and Custom Attribute Mapping from MII 12.1 DEV to QAS and PRD.
    My question is: When exporting Custom Attributes from Configurations menu, it will export Custom Attribute Mapping too? How can I export and import Custom Attribute Mapping from DEV to QAS and PRD?
    Thanks

    Manoel,
    have you tried the following:
    - open System Management / Configurations
    - unmark the "Select All" and only mark the "Custom Attributes"
    - click export and save the zip file
    The exported zip file should include all the settings. In your follow up systems QAS and PRD you can import the zip file.
    See also SAP Help on [MII 12.1 Configuration|http://help.sap.com/saphelp_mii121/helpdata/en/43/e80b59ad40719ae10000000a1553f6/frameset.htm]
    Michael

  • Edit OID Object Class to Add custom attributes

    Has anyone edited an existing object class( in my case orclADUser ) and added custom attributes to it?
    If so
    1) what is the best way to add it (oidadmin Schema management ? )
    2) what is the impact on such custom attributes ?

    Yes and no.
    I've done this but I created my own classes in the oidadmin. Then I populated them.
    My application searched through these attributes (in a separate part of the OID). One attribute pointed to the DN of the user.
    Doing it in this way will ensure that standard software and updates will not break your setup.
    cu
    Andreas

  • Parameterized inheritance and implementation

    I'm learning generics, and I'm having a problem getting the following to work
    I have a base class with some data/behavior
    public abstract Base<E> {
    //...Then there is a concrete class that extends Base and implements Map
    public Concrete<E extends Object & Map<K,V>> extends Base<E extends Object & Map<K,V>> implements Map<K, V>{
    //...I cannot seem to specify that the type for Base must be a Map<K, V>.
    I've thought about containing and delegating, but really Concrete IS-A Base and Concrete IS-A Map.
    Am I missing something about inheritance and generics?
    Any suggestions?

    James,
    Based on your previous posts I think you understand generics as well as I do, and in some aspects, probably better.
    I was trying to capture my thought processes (and that is quite hard since mostly this happens sub-consciously - its quite hard to drag it up into consciousness then document it, but the effort was worthwhile for me and hopefully for others as well).
    In this particular case, E is Map<K,V>, but there could be all sorts of relationships between the type variables, the idea is to identify these and back substitute them, slowly getting rid of type variables until you can't get rid of any more. The ones you are left with are the ones that need to be type parameters.
    take the other post from yesterday
    http://forum.java.sun.com/thread.jsp?thread=554360&forum=316&message=2719355
    as another worked example...
    from
    "And I'm trying to create a special generic container (List) which would only take elements that
    implement the Keyable interface above. For example:
    public class ListOfKeyables <E extends Keyable> extends AbstractList<E>{..."
    and
    "Now, besides standard List methods that use type varable 'E' in their definitions, I would also
    like to have a special method like this:
       public E getByKey(Object key)   {   ... "
    I would start with (ignoring their "E extends Keyable" suggestion, its too premature for that).
    public class ListOfKeyables < ???? > extends AbstractList<E> {
        public E getByKey(Object key) { ... }
    } but "only take elements that
    implement the Keyable interface" suggests replacing E with Keyable<K> thus
    public class ListOfKeyables < ???? > extends AbstractList<Keyable<K>> {
        public Keyable<K> getByKey(Object key) { ... }
    Note In this case the substitution getting rid of E introduced another type variable (K), thats OK, its still a step toward a solution.
    Then the original poster said "But I would like to constrain the 'key' argument in this method to be of type that is specified as a type parameter to the Keyable interface"
    So after implementing this requirement we have
    public class ListOfKeyables < ???? > extends AbstractList<Keyable<K>> {
        public Keyable<K> getByKey(K key) { ... }
    }At this point there is no more substitutions or requirements to fulfill.
    So we look through and see what type variables are still unresolved. These (in this case there is only one K), are then the type parameters of the class, and thus we have what I suggested in that post
    public class ListOfKeyables <K> extends AbstractList<Keyable<K>> {
        public Keyable<K> getByKey(K key) { ... }
    }As a final step, we need to look at the type parameters and decide if they need any constraints (K extends something), These might come from some use of the type parameter ( such as if Keyable constrained its K parameter, we would need to do the same), or from the application requirements. But in this case, there are not any.
    At a certain level of abstraction, this process is not a whole lot different to the process you use when working out what parameters a method or constructor needs (and that process also tends to happen below the consciusness threshold).
    In really simplistic terms, the answer to both "what parameters do I need" questions is "all the ones you can't get from somewhere else or derive from the ones you already have".
    Bruce

  • Selecting custom attributes from the default helpdesk screen?

    Can i select and see custom attributes from the default helpdesk screen?  I dont want to have to click through to the details tab as things can and have been missed.  See picture attached.
    This topic first appeared in the Spiceworks Community

    I have worked out the issue. I was attempting to access attributes from the BOR Object "WorkItem" as opposed to elements in the workflow container. When I created a custom container element called "ReferenceID" (as the element name) and used this in my XML it worked successfully.
    I hope this helps someone else in the future.

  • How to implement Custom Authentication and Authorization in Oracle SOA 11g

    Can anyone please tell me, how to implement Custom Authentication in Oracle SOA 11g ?
    Because in Oracle SOA 10.1.3.4 , i have implemented this custom authentication and authorization by implementing BPMAuthenticationService, BPMAuthorizationService, BPMIdentityService to verify againt my database systems.
    implementation classes like the mentioned below
    1).
    public class SampleAuthenticationService extends SampleServiceBase implements BPMAuthenticationService {
    2).
    public class SampleAuthorizationService extends SampleServiceBase implements BPMAuthorizationService {
    3).
    public class SampleIdentityService extends SampleServiceBase implements BPMIdentityService {
    Please help me to implement the authentication and authorization in Oracle SOA 11g .
    thanks in advance

    To start with please go through following document
    http://docs.oracle.com/cd/E21764_01/integration.1111/e10231/adptr_jms.htm
    http://docs.oracle.com/cd/E23943_01/integration.1111/e10231/adptr_file.htm
    Regards
    Arpit

  • HTML 5 and Spry.. Making custom attributes valid

    The HTML 5 spec is still a "Editors Draft" but doesn't mean browser haven't started intergating it. While i was reading through the specification i noticed that HTML allows you to specify custom attributes on elements (see: http://dev.w3.org/html5/spec/Overview.html#embedding-custom-non-visible-data ). We all know Spry also uses custom attributes for the Spry dataset. These are typically prefixed with spry:action_here=""
    At this point its not valid HTML even though, when serving your page as xhtml it should be valid.. as xml allows you to specify custom attributes as well. But that aside, with the release of HTML5 getting closer and closer we could make Spry attibutes valid if we started prefixing all custom attributes with data-
    For example:
    spry:region="ds1"     =>     data-spry:region="ds1"
    spry:if="0 == false"  =>     data-spry:if="0 == false"
    A switch to the data- prefix would require very little editing of the existing spry files. The only thing users would have to do, is switch to the HTML5 doc type declaring to make it valid. As this doc type has backwards compatiblity and do not force IE6 in quirksmode i feel this is better alternative to externalizing the custom attributes or waiting for browser to support extended doctypes.
    So i wonder what you opinions are on this . Is Spry ready for HTML5 and is HTML5 ready for Spry ?

    Am I excited about the upcoming HTML5? YES!  But not because it validates our Spry attributes.
    Spry, if used properly, already works well and the fact that it is not validated by W3C can be regarded as a curious fact. Sort of like a driver of mine that has not been validated by Microsoft; without the driver my hardware does not work. So what do I do?
    Well for some people its not a problem that the pages do not validate. But there companies and clients who value validation. Its understandable because people are overhyping it. In this case, it would allow to validate out of the box, without any changes to your code. Making it easier for starting developers and create a W3C valid document.
    I am excited about the new HTML5 elements that will be introduced, hopefully making life easier.
    Well doesn't really make a life easier. I'm currently creating my online resume in HTML and its harder... Normally you would just use divs for almost every layout wrapper now you got to choose between aside, section, article, details, hgroup, header etc. So much elements to choose from, but using them wisely is the hard part.
    I am not excited about the fact that HTML5, being backward compatible, will come with the deficiencies of its predecesors
    I am confused about the near simultaneous release of XHTML2. Where is the logic? Cannot the regulators and validators agree on a standard? I guess not. Even the browser-producers cannot agree on a standard. Remember the confusion with audio and video tapes?
    All of this confusion only adds weight to my argument, who cares about W3C validation or Microsoft validation? if it works it works!
    Some people like it strict some people don't, for performance reasons i actually choose for the loose version. It allows me to build a more compressed file .
    Video codec wars are fun to.. Ogg  vs MPEG. Using flash as fallback or silver light for unsupported browsers, or just generate multiple formats.. Hard to choose.. I personally hope h.264 codec will be used because its quality wise its much better. But we will see what the browser vendors will decide. 

  • How to extend the WebUI product search results with customer attributes

    Hello,
    We are using CRM 7.0. We want to extend the WebUI product (Object) searches with customer attributes and to display customer attributes in the search results. We found the note 1026956 that explains how to extend the WebUI product (Object) searches with customer attributes. We want to know if there is also some note that explains how to display customer attributes in the search results for products/Objects.
    Thanks in advance,
    Sergey Kozyrev

    Sergey,
    I doubt whether there exists such note. The note 1026956 which you mentioned is for enhancing the Search for Custom attributes. For Enhancing the Result list you need to do custom development.
    Regards,
    Harshit

  • Problem with setting custom attribute and it being searchable

    I'm having an issue with setting a custom attribute and having it be searchable using Portal 10.1.4. The situation that we have is that we initially added a bunch of files to Oracle Portal using webdrive. Later on, we decided that we needed another custom attribute called "Pinned Item" that will be used for searching (boolean value) and gave it a default value of false. The attribute was then added to the "File" item type in the "Shared Objects" group.
    It appears that since this attribute wasn't initially available on the file object, we couldn't search on it so we decided to set it programatically. First, I tried using wwsbr.set_attribute but it errored out seemingly because the value wasn't set in the first place. If I set a value first by using the web front end, I could then use the set_attribute procedure.
    So, I moved on to using wwsbr_api.modify_item and it appears to set it (although everything is being set to false until I changed it to "text" instead of "boolean" which is OK because that's what I wanted anyway... see metalink bug 390618.1). I'm using the method outlined in metalink doc 413079.1. When I do set it to a "1", and edit the item the check box is checked indicating that it is set correctly. And if I just click "OK" to save the attributes after I open it everything works like it should.
    However, the advanced search (and custom search portlet) and the search APIs are not picking it up. I'm not sure if I'm hitting Metalink bug ID 5592472 or not as that's using the "set_attribute" procedure instead of the modify_item procedure. And their "workaround" of setting the attribute in the UI isn't really feasible for a couple thousand files.
    So far I've tried the following things to get it working:
    1. I am calling wwpro_api_invalidation.execute_cache_invalidation
    2. I have executed wwv_context.sync
    3. I cleared the page group cache
    4. I invalidated all of the web cache
    Does anyone else have any other suggestions?

    I'm having an issue with setting a custom attribute and having it be searchable using Portal 10.1.4. The situation that we have is that we initially added a bunch of files to Oracle Portal using webdrive. Later on, we decided that we needed another custom attribute called "Pinned Item" that will be used for searching (boolean value) and gave it a default value of false. The attribute was then added to the "File" item type in the "Shared Objects" group.
    It appears that since this attribute wasn't initially available on the file object, we couldn't search on it so we decided to set it programatically. First, I tried using wwsbr.set_attribute but it errored out seemingly because the value wasn't set in the first place. If I set a value first by using the web front end, I could then use the set_attribute procedure.
    So, I moved on to using wwsbr_api.modify_item and it appears to set it (although everything is being set to false until I changed it to "text" instead of "boolean" which is OK because that's what I wanted anyway... see metalink bug 390618.1). I'm using the method outlined in metalink doc 413079.1. When I do set it to a "1", and edit the item the check box is checked indicating that it is set correctly. And if I just click "OK" to save the attributes after I open it everything works like it should.
    However, the advanced search (and custom search portlet) and the search APIs are not picking it up. I'm not sure if I'm hitting Metalink bug ID 5592472 or not as that's using the "set_attribute" procedure instead of the modify_item procedure. And their "workaround" of setting the attribute in the UI isn't really feasible for a couple thousand files.
    So far I've tried the following things to get it working:
    1. I am calling wwpro_api_invalidation.execute_cache_invalidation
    2. I have executed wwv_context.sync
    3. I cleared the page group cache
    4. I invalidated all of the web cache
    Does anyone else have any other suggestions?

  • Extending and implementing

    Is there a way to tell the compiler: this variable is of this class and implements that interface.
    Say for instance a Component that implements ActionListener
    extending component with an abstract class that implements ActionListener and then extend this class wouldn't work since then i can'T as well extend button textArea ect.

    if(variable instanceof Component) {
    //do something
    if(variable instanceof ActionListener) {
    //do something else
    if( (variable instanceof Component) &&
    (variable instanceof ActionListener) ) {
    // really do something else
    }

Maybe you are looking for