Expanding Objects

I am a relatively experienced Java coder, but I am having trouble with this one for some reason...
Let's say I have 4 Objects. Form, IntField, TextField, DropField
All the *Field Objects have some similar attributes (let's say idNumber & name)
And a Form can contain any amount or combinations of these Objects.
So I started with an Abstract Object GeneralField it contained the name, idNumber variables.
Then I had
public class IntField extends GeneralField{...}etc.
My Form Object had a List<GeneralField> and that works well.
But it became more complex. The *Field types all have different methods. For instance an IntField can have a getMaxInt(); and a DropField has a getIndex();
But if I have a loop: for(GeneralField gf : list)
gf can never have access to getMaxInt(); (Obviously).
So I then add into the mix IField (an Interface which contains all the possible methods)
and now I have:
public class IntField extends GeneralField implements IField{}and my List<IField>
But what I now get is IField always has access to getMaxInt() even for a TextField which that makes no sense for. Now I know I could easily just throw an NonsensicalAttributeException or return null, but that doesn't seem appropriate.
So I started reading more about the Decorator pattern, which I would build an Interface called IIntField and call
IIntField myInt = new IIntField(new IntField()); and that easily goes into my List<IField>
but then if I do my loop for(IField f : list) I need some way of knowing that this instance of f is an IIntField. Without resorting toinstanceof.
I read up on various other patterns and nothing seems to do what I want. The only thing I can think of is to have a boolean on IField that says isIIntField() and when I create a new IIntfield set it to true then I can cast it:
for(IField f : list){
     if(f.isIIntField()){
           IIntField i = (IIntField)f;
}But that is horribly messy and not that extensible.
I am sure I am missing something super basic, but I just cannot see it yet.
Can anyone point me in the correct direction?
I basically need a way of going through List<*Field> and having access to all the various attributes that that particular instance may have.
Thanks,
Craig

cstoss wrote:
@Horst_M I used the Visitor pattern in a previous project and had a lot of success with it, I peaked at it for this but couldn't visualize it. I will have another look for sure.Looking at your code example the visitor pattern cries out loud "visit me".
Original code:
for(IField f : list){
     if(f.isIIntField()){
           IIntField i = (IIntField)f;
}will be changed to:
ConcreteVisitorA implements IVisitor
for(IField f : list){
   f.accept(this);
public void visitIntField(IIntField i) {
}And IIntField will be extended with:
public void accept(IVisitor v) {
  v.visitIntField(this);
}

Similar Messages

  • Saving back from CC17 to CS6 changes all complicated brushes into expanded objects.

    saving back from CC17 to CS6 changes all complicated brushes into expanded objects. Also brushes vanished from brush pallet

    http://helpx.adobe.com/illustrator/using/whats-new-17-0.html#Images%20in%20brushes
    Since the Brushes were rewritten for CC, backsaving them (as well as other items) will cause them to be expanded. No way around it.

  • Grouping and expanding objects

    This question was posted in response to the following article: http://help.adobe.com/en_US/illustrator/cs/using/WS714a382cdf7d304e7e07d0100196cbc5f-62c7a .html

    I don’t think so, unless someone has invented a script for doing it.
    And by the way, strokes are still ‘objects’, just as they are after expanding.
    A better term would probably be ‘open paths with stroke’ or something like that.

  • Adding multiple expander objects

    Hello guys,
    I have a form in which I need to add couple of expanders to group my objects. Since expander is not listed in toolbox, I added it on xml file. The problem is when the expander above is collapsed, the below ones don't move up. What I need is the expanders
    below to start after the previous ones instead of setting 'top' property.
    Now, I tried to use stackpanels to house expanders but somehow it didn't respond the way I wanted and since I wasn't even sure that using stackpanels was the answer to my problem, I decided to ask you guys.
    I also saw that on default forms an object named ScrollViewer is being used under expanders but I couldn't add one to my form.
    Thanks for your help,
    Burak

    Hi all,
    I finally figured it out. I added only one stack panel outside of expanders, set margin values of stack panels to "0" and set height/width values to "Auto" and it worked. :) Anyway, if anyone face a similar problem and needs help, feel free to
    ask.
    Here is an example;
    <AddControl Parent="Grid_1" Assembly="PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Type="System.Windows.Controls.StackPanel" Left="0" Top="0" Right="432" Bottom="1229" Row="0" Column="0" />
    <AddControl Parent="StackPanel_1" Assembly="PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Type="System.Windows.Controls.Expander" Left="0" Top="0" Right="0" Bottom="0" Row="0" Column="0" />
    <AddControl Parent="Expander_1" Assembly="PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Type="System.Windows.Controls.Grid" Left="0" Top="0" Right="0" Bottom="0" Row="0" Column="0" />
    <PropertyChange Object="Grid_2" Property="Width">
    <NewValue>600</NewValue>
    </PropertyChange>
    <PropertyChange Object="Grid_2" Property="Height">
    <NewValue>300</NewValue>
    </PropertyChange>
    <PropertyChange Object="Grid_2" Property="HorizontalAlignment">
    <NewValue>Left</NewValue>
    </PropertyChange>
    <PropertyChange Object="Grid_2" Property="VerticalAlignment">
    <NewValue>Top</NewValue>
    </PropertyChange>
    <PropertyChange Object="Expander_1" Property="HorizontalAlignment">
    <NewValue>Left</NewValue>
    </PropertyChange>
    <PropertyChange Object="Expander_1" Property="VerticalAlignment">
    <NewValue>Top</NewValue>
    </PropertyChange>
    <PropertyChange Object="Expander_1" Property="MinHeight">
    <NewValue>0</NewValue>
    </PropertyChange>
    <PropertyChange Object="Expander_1" Property="MinWidth">
    <NewValue>0</NewValue>
    </PropertyChange>
    <PropertyChange Object="Expander_1" Property="Height">
    <NewValue>Auto</NewValue>
    </PropertyChange>
    <PropertyChange Object="Expander_1" Property="Width">
    <NewValue>Auto</NewValue>
    </PropertyChange>
    <PropertyChange Object="Expander_1" Property="IsExpanded">
    <NewValue>True</NewValue>
    </PropertyChange><AddControl Parent="StackPanel_1" Assembly="PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Type="System.Windows.Controls.Expander" Left="0" Top="0" Right="0" Bottom="0" Row="0" Column="0" />
    <AddControl Parent="Expander_2" Assembly="PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Type="System.Windows.Controls.Grid" Left="0" Top="0" Right="0" Bottom="0" Row="0" Column="0" />
    <PropertyChange Object="Grid_3" Property="Width">
    <NewValue>600</NewValue>
    </PropertyChange>
    <PropertyChange Object="Grid_3" Property="Height">
    <NewValue>300</NewValue>
    </PropertyChange>
    <PropertyChange Object="Grid_3" Property="HorizontalAlignment">
    <NewValue>Left</NewValue>
    </PropertyChange>
    <PropertyChange Object="Grid_3" Property="VerticalAlignment">
    <NewValue>Top</NewValue>
    </PropertyChange>
    <PropertyChange Object="Expander_2" Property="HorizontalAlignment">
    <NewValue>Left</NewValue>
    </PropertyChange>
    <PropertyChange Object="Expander_2" Property="VerticalAlignment">
    <NewValue>Top</NewValue>
    </PropertyChange>
    <PropertyChange Object="Expander_2" Property="MinHeight">
    <NewValue>0</NewValue>
    </PropertyChange>
    <PropertyChange Object="Expander_2" Property="MinWidth">
    <NewValue>0</NewValue>
    </PropertyChange>
    <PropertyChange Object="Expander_2" Property="Height">
    <NewValue>Auto</NewValue>
    </PropertyChange>
    <PropertyChange Object="Expander_2" Property="Width">
    <NewValue>Auto</NewValue>
    </PropertyChange>
    <PropertyChange Object="Expander_2" Property="IsExpanded">
    <NewValue>True</NewValue>
    </PropertyChange>

  • Can't delete Symbol without expanding object

    I have a 3D Extrude & Bevel effect on an object. I mapped a symbol to it, but then I cleared the symbol from the Map Art dialog by clicking "Clear All." Now I am trying to clean up the file, and when I go to delete the symbol from the Symbols panel, I get the message about the symbol being in use and the choice to expand or delete.
    The Symbol is NOT mapped to anything in the file, and I don't want to expand the 3D Live Effect. I fianlly had to clear the appearance altogether, then delete the symbol. Shouldn't I be able to delete the symbol if it's not in use?

    function(){return A.apply(null,[this].concat($A(arguments)))}
    ...the original art for the symbol becomess and instance for the symbol...
    Depends on version.
    JET

  • Availability reports expand object list when opened via web not console after upgrading to UR5

    recently upgraded to UR5 from UR3 of SCOM 2012 SP1.
    This worked fine before the upgrade and now it does the following odd behavior with the "+ object(s)" link.
    I created an availability report (MS Generic Report Library) for one or more servers through the console.  It looks OK through the console, but when I open the report through the web interface to the report server, the "+ object(s)" section
    is already expanded.  It even shows a plus "+" sign when it IS expanded and changes to a minus "-" sign when it is collapsed.  This is backwards.
    This worked OK prior to UR5.
    Ideas?
    Ted

    Hi,
    This issue should be related with the report definition in the SSRS, it seems like that the object's visibility value  is show, but the sign is "-" when defined in the SSRS.
    Please post in the SQL forum for further assistance.
    https://social.technet.microsoft.com/Forums/sqlserver/en-US/home?forum=sqlreportingservices
    Regards,
    Yan Li
    Regards, Yan Li

  • Cannot expand object

    Hi,
    I open a pdf in Illustrator and I want to expand it so that I can change colors. I cannot choose the expand option (greyed out). Why is this?
    I use Illustrator CS6.
    I have tried this before without problems.
    Best wishes,
    Anita

    Anita,
    Are you sure you need to Expand anything?
    What happens if you just try to work onthe artwork?
    If you have to do something to be able to work with it, you may look for unneeded Clipping Masks in the expanded Layer in the Layers palette and get rid of them. Clipping Masks may haunt you, especially if you open artwork from a newer version (CC in this case).

  • Expand Stroke makes closed object

    Expanding a stroke used to expand just the line. Now, it
    expands the
    line and makes an object with by closing the path. How can I
    get the old
    behavior back with FHMX?
    TIA

    Thanks for the reply. I don't know what happened. I have used
    FH enough
    to know how the expand stroke tool works. Yesterday, I had a
    simple
    curved path. When I tried to expand the stroke, FH made
    "bowl", a
    compound closed path object by connecting the ends of the
    stroke. I drew
    some more lines with the same results. I worked around this
    to finish
    the job. Now, this morning the expand stroke is working
    correctly. It is
    just making the path a simple closed object. Must have been
    sunspots or
    bad karma.
    dp
    Judy Arndt wrote:
    > D. Plank wrote:
    >
    >
    >>Expanding a stroke used to expand just the line. Now,
    it expands the
    >>line and makes an object with by closing the path.
    How can I get the old
    >>behavior back with FHMX?
    >
    >
    > I can't remember FH's Expand Stroke Xtra ever producing
    two open paths.
    >
    > Select the butt end cap in the Expand Stroke dialog.
    Option-click the end
    > paths to subselect and delete them.
    >
    > There is an intermittent bug in FHMX, though. Sometimes
    instead of giving
    > the expanded object a fill the same color as the
    previous stroke, it will
    > apply the previous stroke and no fill. Is that what
    you're asking about?
    >
    > Judy Arndt
    >

  • Combining separated text into single object ...

    I remember in older versions of Illustrator that when you used pathfinder to combine multiple objects into a single object ... it actually made them into a single object, regardless of weather or not they where intersecting.
    With the more recent versions of illustrator, when you try to "unite" objects in pathfinder ... the only ones that are truly combined into a single object are the ones that overlap ... anything separated will simply be "grouped" and remains a totally separate object ... even if you use "expand objects" on the group.
    I'm trying to use a third party program (path styler) and the problem I'm running into is that when I apply a stroke effect in path styler, it treats every letter in my headline as a separate object (even when united in pathfinder), causing the strokes to overlap the previous letter.
    What I want to do is combine all the letters into one single object (while still leaving space between each letter) so that path styler treats the text (and the outlines) properly. (So the outlines run into each other, instead of overlapping the fill.)
    Any help would be appreciated ... this should be simple ... but I think it may be a case of the program trying to preserve the history of "united" objects when I don't want it to.
    Thanks!

    Make your logo ONE entire compound path, you probably have each letter as an individual compound path.

  • Serious Issues in Illustrator CS6, Expand and Snapping problems

    Hi, my friends and fellow vector fanatics, we all love Adobe Illustrator and we like to work with this tool, and being a user since version CS3 I really like the new look and feel of CS6 however I noticed some issues when I am doing the following:
    when I use pathfinder to expand objects they look weird like in this photo
      you can notice the change in the r and also the a they changed shape
       this is completly un acceptable, since the design has to be very precise
      second issue is when I am trying to move an object it snaps to something I don't know if its a grid or not and I have checked off snapping to grid but still all objects snaps.
    please I am eager to solve these problems and I am looking forward for your help.
    thank you all for you cooperation

    Hi All,
    Just thought id add this also to the forum just incase you dont want to keep going back and unticking the Align to Pixel Grid option box. If you want it off completely, then go to the small arrow (far right of the transform palette) and turn off Align New Objects To Pixel Grid. Then things wont snap everytime you create a new shape or add guides etc..hope that helps vector buddies
    Chris .

  • Expand gradient mesh

    hello,
    i'm trying to create a distressed look on an object that has a gradient mesh appliet to it. i've done this with regular objects but never on one with a gradient mesh. one of the steps in this process is to expand the object, but i'm not able to do so because the expand option is grayed out in the drop down menu.
    normally after expanding the object i would use one of the artistic charcoal brushes to create a texture over the object in a different color. then i would select the brush strokes and expand apperance. then, using the pathfinder, i would merge the expanded brush strokes with the expanded object and then delete the brush stokes. what remains is the object with little cut-outs where the texture of the brush strokes used to be.
    however i can't do this because i can't expand the object with a gradient mesh.
    anyone know of another way to do this?
    thanks.

    You can always use your brush daubs as a clipping mask.
    Mylenium

  • Illustrator: Expanding Blend Mysteriously Changes Shape

    Hi all!
    My name is Alexis I have a blending problem (hiiii Alexis...).
    Okay, seriously, I've used the blend tool to make a series of lines between two other lines; I need to expand everything so that the whole thing becomes a fill-only object (no strokes):
    - I expand it (Object > Expand; Object box checked, Fill box checked, Stroke box checked) and the object becomes strokes-only (no fill at all)
    - I expand it again (Object > Expand; Object box greyed out, Fill box checked, Stroke box checked) and the object becomes fill-only (yay!) except the shape of the lines has changed (boo!). Unchecking the stroke box and leaving only the Fill box checked seems to have no effect, the object remains stroke-only).
    What's going on here?
    I've made a diagram to explain my problem a little better in case I haven't been clear enough: http://tinypic.com/r/6pqbyc/5
    Please and thank you!
    A

    This is a shot in the dark, I admit, but;
    After you expand the first time, while the shapes are only strokes, what happens if you try Object > Path > Add Anchor Points before expanding the second time?
    It really shouldn't make any difference, but I've seen cases where it does.
    --OB

  • Selecting objects of one color

    So, I find that when I image trace and go to remove the white space of my expanded object it takes FOREVER to clean it all up. What I really need is a selection option similar to Photoshop (contiguous or not) to get rid of all the excess faster. Is there a way to do this? Forgive me, I am newer to the program.
    Thanks!

    SUre. The select functions in the menu and swatches palette are your friend....
    Mylenium

  • How do you expand text with an outline?

    I'm trying to expand some type with a fill and an outline into a simple shape and am having a hell of a time (no surprise there.)
    When I expand the text, the outline remains... an outline.
    Here's what I'm doing: I'm trying to reproduce a logo. I set some type with Garamond and it needs to be just a bit thicker. So I added an outline and it looks good. Now I need just a shape, no text, no outline. Everytime I expand it the type expands but the outline doesn't.

    For anyone else....
    Object > Expand (object and fill)
    then
    Object > Expand (fill and stroke)
    then
    Pathfinder > Merge.
    Or...
    Type > Create Outlines
    then
    Object > Expand (fill and stroke)
    then
    Pathfinder > Merge.

  • Error while mapping two times nested table

    Hi,
    I have a Product table which has nested ProductSubcategory in it.
    ProductSubcategory nested table also has nested table ProductCategory inside it.
    So there is a nested table inside nested table.
    I designed a dimension on warehoue builder and while mapping, i got "ORA-22913: must specify table name for nested table column or attribute" error.
    I mapped nested tables before with using varray iterator and expand object, but they were nested once. Is there any solution for mapping two or more time nested tables?
    Now i exracted tables and i continuou working but, i wondered is there any way.
    Creation codes are below. Thanx :)
    CREATE TABLE PRODUCT
    (     PRODUCTID NUMBER NOT NULL ,
         ProductSubcategory ProductSubcategory,
         MODIFIEDDATE DATE NOT NULL)
    NESTED TABLE ProductSubcategory STORE AS ProductSubcategory_TABLE
    ( NESTED TABLE ProductCategoryId STORE AS ProductCategory_TABLE);
    CREATE TYPE TYPE_ProductSubcategory AS OBJECT (
         ProductSubcategoryID number ,
         ProductCategoryId ProductCategory ,
         Name Varchar(50) ,
         rowguid varchar2(100) ,
         ModifiedDate date );
    CREATE TYPE TYPE_ProductCategory AS OBJECT (
         ProductCategoryID number ,
         Name Varchar(50) ,
         rowguid varchar2(100) ,
         ModifiedDate date );

    Bharadwaj Hari wrote:
    Hi,
    I agree with u...I am not sure of the environment the user has so i put forth all the 3 option that crossed my mind that time....thats why i said he has to choose what best suits him/her...
    Also if the database is huge and we create physical temp tables (option 2 and ur idea) its like having redundant data in the database which is also a problem....So ist upto the user to actually evaluate the situation and come up with what best suits him/her...
    Regards
    BharathHi,
    I understand your opinion. But I am not sure that the user have enough experience to choose the best option by his one. And about the redundant data: because of this I wrote that he should truncate the tables after the last mapping which loads all data into the real target table.
    Regards,
    Detlef

Maybe you are looking for

  • Can't remove or redeploy one process on 10.1.3.5

    The 10.1.3.5.0 WEB BPEL Console appears to be different from the older one. I use to always be able to undeploy a BPEL process to clean up an deployment issue, but this new interface is different. I have one BPEL process which some how got deployed (

  • Image order in Bridge photo downloader

    In Photoshop Elements 3 for the PC, when I used the organizer to download photos, the photos always opened up in the order in which they were taken. This made it very easy to separate shoots in different locations on the same day, or the same locatio

  • CC (14.x) Bugs

    I've got to the stage where I have to say something, because Photoshop CC is definitely buggy in my experience to date.  The one that annoys me the most is that I suddenly get stuck with a small brush tool that won't go away without restarting Photos

  • Capture the rows selected in a multiselect table view (BSP)

    Hi, My requirement is: I have a table view in which I can select multiple rows. I will be selecting some rows, and pressing a button. Functionality of button is written in Javascript, to open a popup window. But how will I capture which all rows were

  • Device error 370 please tech support help

    How do you fix this There is a reset link with it but all it does is come back to to the same message no rebooting at all please tech support help