How to add new elements in an array of Objects of Type Figure??
I have a Figure class which has many attributes(variables). Then I create an array of Figures for example
Figs[] figures = new Figure[18];
Later I need to add new Figures to this array at different positions. In my case I have to use the same array.
Is there any way so I can add new Figure elements to this array??
If u have an answer to this question, please share with me.
Thanks
Amit
There are many ways to solve this problem, including creating new arrays as needed, and using System.arraycopy() to move things around. However, the best way is to use ArrayList, as discussed above.
What you cannot do is use toArray() and cast back to String[]. Object[] is not a subclass of String[], even if all of the objects in the Object[] are Strings!
There are two ways to get around this. Create a String[] and copy the Object[] into it with System.arraycopy, or the easy way, which is to use the toArray(Object[]) method. It allows you to specify by example the array class you wish returned. If the array is large enough, it will populate the array directly, otherwise it will create a new one of the same base class. That means any of the following approaches will work, the final decision is mostly a matter of style:
// create a zero length array to pass as an exemplar
public final static String STRING_ARRAY_TYPE[] new String[0];
String s[] = (String[]) a.toArray(STRING_ARRAY_TYPE);Or:
String t[] = new String[a.size()];
a.toArray(t);Or:
String t[] = a.toArray(new String[a.size()]);;I prefer the first approach generally, and it avoids any race conditions between the evaluation of the ArrayList size and the toArray; however, since ArrayList methods are not synchronized, you probably should do some synchronizing of your own.
Hope this helps.
Similar Messages
-
How to add an element to an array, then be able to remove it specifically
So i have a list of numbers. The user is able to then add numbers to that list. I have a button which allows the user to remove any number of their choice by typing that number in a textbox. For some reason the numbers that the user add to the list will not dissapear when chosen whereas the original numbers go away no problem.
The name of the array itself is mesEntiers and the name of the texbox is : IntegersIn_txt
Here is the code :
function supprimer(event:MouseEvent):void
var indiceChiffre:int;
indiceChiffre =(mesEntiers.indexOf(IntegersIn_txt.text));
// La méthode indexOf renvoie l'indice d'un élément ou -1 si non trouvé.
trace("testBtn")
if (indiceChiffre != -1)
for (var i=indiceChiffre; i <mesEntiers.length; i++)
mesEntiers[i] = mesEntiers[i+1];
trace("test")
mesEntiers.pop();
} // Fin fonction supprimer.Two things I can think of (I ran a small test)...
1) Make sure your textfield is a single line, not multiline... multilines end up with extra stuff in them that you can't see.
2) Convert the text into a number unless the array is holding strings... indiceChiffre =(mesEntiers.indexOf(Number(IntegersIn_txt.text))); -
Can't add new element to model node from web service
Hi Folks,
we are using the old WebService (not adaptive one) for calling a service on XI. We are reusing the same service for loading the data and also sending them back to the backend to modify, delete or add new elements. Request and response tree structure consist basically of the same structure.
Now everything works fine so far except adding a new element to the model tree.
So what are we doing:
After calling the service for reading (and invalidate on the response), we copy the received data from response node into the request node. All the view forms are bound to the model elements in the request.
Modifying single attributes worked just fine (from dialog and programatically). A new element we add to the model tree shows up in the dialog and seems to work equally fine, but when we trigger the service call to send the collected data, every change to the model data is send except the new added element. It just won't be send.
What's the problem here? Seems to me this must be somehow related to the supplying relation role maybe.
What code do you need to look at and how do I mark code in the new forum editor so it gets displayed properly formatted?
Thanks,
okHi,
Can you tell me which code are you using currently for transferrring the data? It might help me to figure out what your problem is. -
How to add new EEW Business Objects
Hi guys,
could you please give me a solution how to add new business objects? Following are the SAP Objects that you can Enhance Using EEWB:
ADS Analytical Data Storage
BUPA Business Partner
BUPR Business Partner Relationships
BUSINESS_ACTIVITY Business Activity
BUSINESS_TRANSACTION CRM Business Transaction
CATEGORY_ENHANCEMENT Category Extension
COMPLAINTS Complaint
COUNTERS Counter
CRM_CASE СRM Case
CRM_RPT Resource Planning Tool
GRANTOR_PROJECT Grantor Project
INDIVIDUAL_OBJECT Individual Object
INSTALLED_BASE Installed Base
LEAD Lead
MARKETING_ELEMENT Marketing Element
OPPORTUNITY Opportunity
PPR Partner/Product Range
RELTYPE Relationship Category
SALES_CONTRACT Sales Contract
SALES_TRANSACTION Sales Transaction
SERVICE_CONFIRMATION Service Completion Confirmation
SERVICE_CONTRACT Service Contract
SERVICE_TRANSACTION Service Process
SOLUTION_DATABASE Solution Database
But, i didn`t find how add it.Hi,
To my knowledge adding objects to EEWB is possible by customers, SAP controls which all objects enhancement are possible through EEWB, the objects which you have listed are supported by sap for enhancement via EEWB.
If you are on CRM 7.0 you can use AET which supports more objects that can be enhanced.(AXTREG - transaction for AET supported objects)
Hope this helps.
Cheers,
Sumit Mittal -
How to add new group attribute in OAM?
Hi,
I'm using SunONE DS 5.2 P4 as my Oracle Access Manager repository. I would like to add some new attributes to Users and also to Groups.
I am able to add the new attributes to users by adding the attributes to the oblixorgperson object class in SunONE DS, and then the new attributes appear in the OAM web admin (under the inetorgperson object class).
I have tried to do similar thing to add attributes to Groups. I have added the new attributes to the oblixgroup object class in SunONE DS, but the new attributes do not appear in the OAM web admin anywhere (e.g., under the groupofuniquenames, etc. object class).
Can anyone tell me how to add new attributes to SunONE DS so that they are available under Groups in OAM?
Thanks,
Jim LumHave you added the auxiliary class "oblixgroup" to the Group Manager?
1. Ensure that you have configured the object class or classes that you want to add in the Common Configuration tab.
2. From the Identity System Console, select Group Manager Configuration, then click Configure Group Type.
3. Click Configure Group Type Panels, then click Create.
4. In the topmost menu, select the object class that you want to add.
5. In the Panel Label field, enter the label that you want to display to end users when they view elements from this object class in the Group Manager.
6. Select the Panel Information Is Complete check box.
7. Click Save.
The object class is added. You can view this new object class by clicking the Tabs link in the left navigation pane for Group Manager Configuration. -
How to add new fields in Reduced message ( in BD53 )
Hi Experts,
How to add new fields in Reduced message ( in BD53 ), when the required field iis available in Table or Structure and need to be added in BD53 so that we can ALE.
Thanks,
NinadHello,
I think of something like:
First, you create extension, with transaction WE30.
Then, reduce your idoc, your extension should also be proposed.
Do not forget to add this extension in outbound we82, and/or we57 in inbound, and WE20, and find BTE or exit to populate extension.
regards.
F.S. -
PLz Help me its urgent, how to add new field in mm01 basic data screen
Hi everyone,
plz tell me how to add new field in mm01 basic data screen,i added that field in basic data screen but when i create a material the data for that field will not save in database table.
Thanks,
murali.Hi Murali,
when created added a field on the screen by using user exit then after that you have add the field in main table where you will be getting these table in the userexit only, please make sure about this. And i am sure defenitly it will get updated in to the table.
reward if useful.
thanks
abdulsamee. -
How to add new line in message on my S890
My stock keyboard in Lenovo S890 doesn't have enter key, is this normal ? How to add new line ?
However this happened only in messages, while using whatsapp the enter key present.Hi,
the fact that your question is posted in Order Management section, does the move order automatically generated by OM?
nevertheless, i don't think you should (or allowed, in this case) to add a new line in transact move order. Transact move order only queries (not create records) the move order lines eligible to allocate and transact.
So, I don't see why you need to add a new line in transact move order.
You can, however, add a new line in the allocation of the lines, where for instance, you need to have half of the line allocated to one locator, and the other half to another locator
Thanks -
How to add New field in SMART forms.
How to add new field in the SMART FORMS. Please know me the step.
Please help me soon.
Moderator message: Welcome to SCN!
Moderator message: please search for available information/documentation, do not use a priority higher than normal (no "soon", "ASAP", "earliest" etc.).
[Rules of engagement|http://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement]
[Asking Good Questions in the Forums to get Good Answers|/people/rob.burbank/blog/2010/05/12/asking-good-questions-in-the-forums-to-get-good-answers]
Edited by: Thomas Zloch on Jun 17, 2011 12:31 PMHow to add new field in the SMART FORMS. Please know me the step.
Please help me soon.
Moderator message: Welcome to SCN!
Moderator message: please search for available information/documentation, do not use a priority higher than normal (no "soon", "ASAP", "earliest" etc.).
[Rules of engagement|http://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement]
[Asking Good Questions in the Forums to get Good Answers|/people/rob.burbank/blog/2010/05/12/asking-good-questions-in-the-forums-to-get-good-answers]
Edited by: Thomas Zloch on Jun 17, 2011 12:31 PM -
How to add new text field in standard report
how to add new text field in standard report?
Hi,
I presume you are talking about a report display in ALV and u wish to add a column to it .
If it is a global requirement ,as in table being used there in ALV can be modified, then you can append the table and the system should pick up the same automatically from there.
Otherwise , you can make a Z program . Modify the catalog being used in ALV.
Regards,
Shweta -
How to add new row and update existing rows at a time form the upload file
hi
How to add new row and update existing rows at a time form the upload file
example:ztable(existing table)
bcent smh nsmh valid date
0001112465 7.4 26.06.2007
0001112466 7.5 26.06.2007
000111801 7.6 26.06.2007
1982 7.8 26.06.2007
Flat file structure
bcent nsmh valid date
0001112465 7.8 26.06.2007 ( update into above table in nsmh)
0001112466 7.9 26.06.2007 ( update into above table in nsmh)
000111801 7.6 26.06.2007 ( update into above table in nsmh
1985 11 26.06.2007 new row it should insert in table
thanks,
Sivagopal RHi,
First upload the file into an internal table. If you are using a file that is on application server. Use open dataset and close dataset.
Then :
Loop at it.
*insert or modify as per your requirement.
Endloop.
Regards,
Srilatha. -
11.5.9/OAF 5.7 : how to add new fields in iProc "search results" page
We need to add new fields into iProc "search results" page - "Personalize Self-Service Defn" is et, we can enter the personalization screens (from both the "master" link at top/right page level or from the link above the region) - anyway cannot find how to add new fields. Do we have to go to AK developer and/or XML files or is it feasable from OAF (as it is with 11510) ? TIA.
It depends on what fields you want to add.
1. If Oracle has included the fields, just render them via personalizations
2. If they are brand new fields:
a) you will need to extend the VO (I do not know the exact name).
b) change the query to get your extra db columns if necesary
c) add transient attributes to the VO and map them to b).
d) Then you need to add the items via personalization and map them to the attributes you created in c)
Check on metalink for the lates version of OAF Dev Guide and Personalization guide.
Thanks
Sandeep -
Query: How to add new fields in ABAP query?
Hi All,
Can any one tell me how to add new fields in the ABAP query output?
We have to add the new fields using query design or we have
to add those in the background program(automatically generated behind query) by selecting new fields in the code?What kind of report? Usually, you have to add the field in the table declaration and then also in the SQL query. After that, include the field in what kind of report you are using.
-
CRM IC Winclient - How to add new fields in the BP Search of TRX CIC0
Hello Experts,
I want to know how to add new fields in the BP Search of TRX CIC0. In the HTML that we're using here I need to add the URL of the BP.
Can you help me?
Thanks in advance.
Caíque EscalerHi
make append to tables in se11 - CCMBP1FIELDS, CCMBP2FIELDS
in spro in Define customer-specific search control -> mark fields with X.
and enhance html template CRM_CIC_SEARCH_DISPLAY. -> tcode smw0, look for package CRM_CIC_COMPONENTS for html CRM_CIC_SEARCH_DISPLAY. export it from SAP, edit, and import.
you will need to enhance function module used for searching - you will find him in spro in Search Strategies.
Regards
Radek -
How to add new fields to picklist of search criteria for opportunities
Hi Friends,
Could you please tell me how to add new fields to the picklist of search criteria of Opportunities in WEBCLIENT(CRM 2007).
Regards,
VijayDear Vijay,
We are facing the same problem over here.
Have you managed to find a solution? Please share
BR,
Rohit
Maybe you are looking for
-
Hi all, Currently, I am developing a report to show all open items (like transaction FBL5N, Open Item at Key Date). Now, my report just manage to display all open items as per selected key date, but not manage to show those items that were cleared. e
-
Good night, I am just starting in bussines design, i am not rich enough to buy photoshop license, but i'm loved to use photoshop, could i use photoshop cs2 for free version? Thanks alot for your attention.
-
How to pass a parameter into a sql expression?
How to pass a report parameter into a sql expression?
-
Oracle BPM and IPM intergration
Hi all Im new in the ECM space and im still learning the modules (IPM and BPM) Can anyone tell me about the intergration between BPM and IPM, how it works and a case study would also be nice. You can also point me to documentation that can give me th
-
I need to pass an ip address into a method. So I know its type InetAddress. If the IPAddress is 10.100.50.33. how would I pass it in to the method. eg: SysNameScanCommand( )Would it be like this? SysNameScanCommand(InetAddress 10.100.50.33 )