Change fields via field.set

I don't quite know if this is the right approach for the problem, but I hope, anyone can make that clear to me:
I got two Applications called "app1" and "app2". app2 is a simple swing-application which, to make it simpler, only consists of a JTextField (pseudocode following).
JTextField vlaue_1 = new JTextField("test");
...The application app1 now starts app2 (using Class.forName and Method.invoke). Then, it gets all of app2's fields, in this case value_1, via getDeclaredFields.
import java.lang.reflect.Field;
import java.lang.reflect.Method;
public class app1 {
     public app1() {
          super();
       public static void main(String[] args) throws Exception {
            Class testClass = Class.forName("app2");
            Method mainMethod = findMainMethod(testClass, "main");
            mainMethod.invoke(null, new Object[] { String[] arguments });
            Field[] fields = testClass.getDeclaredFields();
     private static Method findMainMethod(Class clazz) throws Exception {
          Method[] methods = clazz.getMethods();
          for(int i = 0; i < methods.length; i++){
               if(methods.getName().equals(name))
                    return methods[i];
          return null;
Now, app1 knows about the TextField in app2.
And finally, the question is: Can I change the String in app2's value_1 into something different out of app1? For example, app1 says "Hey TextField, you are no 'test' any longer, you are now a 'foo'" and app2 updates its swing-GUI instantly?
I already tried a field.set(Obj arg1, Obj arg2) and got only exceptions, but probably because I don't quite know which objects are meant for arg1 and arg2.
Perhaps someone has some (pseudo-)code to clarify this issue.
Any help would be nice. Thanks

Ok, the original code for app2 is the following (the app doesn't make much sense, was only created for testing this issue):
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
public class TestApp extends JFrame implements ActionListener{
     public static JTextField wert1 = new JTextField("15");
     public static JTextField wert2 = new JTextField("12");
     public static JLabel ergebnis = new JLabel("0");
     public static JButton berechnen = new JButton("Berechnen");
     public TestApp() {
          JFrame frame = new JFrame("TestApp");
          JPanel north = new JPanel();
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.getContentPane().add(north, BorderLayout.NORTH);
          north.add(wert1, BorderLayout.CENTER);
          north.add(wert2, BorderLayout.CENTER);
          frame.getContentPane().add(ergebnis, BorderLayout.CENTER);
          frame.getContentPane().add(berechnen, BorderLayout.SOUTH);
          berechnen.addActionListener(this);
          frame.pack();
          frame.setVisible(true);
     public static void main(String[] args) {
          TestApp gui = new TestApp();
     public void actionPerformed(ActionEvent event) {
          double ergebnis_1;
          double wert_1 = Double.parseDouble(wert1.getText());
          double wert_2 = Double.parseDouble(wert2.getText());
              ergebnis_1 = wert_1 + wert_2;
              ergebnis.setText(Double.toString(ergebnis_1));
}The code for app1 follows here:
import java.lang.reflect.Field;
import java.lang.reflect.Method;
public class JavaTester {
     public JavaTester() {
          super();
     public static void main(String[] args) throws Exception {
          Class testKlasse = Class.forName(args[0]);
          String[] neueArgs = uebergebeArgs(args);
          Method mainMethode = findeMethode(testKlasse, "main");
          mainMethode.invoke(null, new Object[] { neueArgs });
          Field[] felder = testKlasse.getDeclaredFields();
     private static String[] uebergebeArgs(String[] args) {
          String[] rueckgabe = new String[args.length - 1];
          for(int i=1; i<args.length; i++) {
               rueckgabe[i-1] = args.toLowerCase();
          return rueckgabe;
     private static Method findeMethode(Class klasse, String name) throws Exception {
          Method[] methoden = klasse.getMethods();
          for(int i = 0; i < methoden.length; i++){
               if(methoden[i].getName().equals(name))
                    return methoden[i];
          return null;
I'm sorry that I can't print the stacktrace, because I just don't know, how to call the field.set function.
Is it for e.g. felder[0].set(???, ???)?

Similar Messages

  • Changing a text field name in an existing PDF via VBA

    Using OLE, I am accessing a given form with the following code:
    Function GetTextFieldNames(strFormName As String, strFieldName)
    Dim myApp As AcroApp
    Dim acForm As Acrobat.AcroPDDoc
    Dim jso As Object
    Dim strTest As String
    Dim Field As Object
    'Set the object references
    Set myApp = CreateObject("AcroExch.App")
    Set acForm = CreateObject("AcroExch.PDDoc")
    acForm.Open (strFormName)
    Set jso = acForm.GetJSObject
    Set Field = jso.getField(strFieldName)
    'Clean up
    acForm.Close
    myApp.Exit
    Set myApp = Nothing
    Set acForm = Nothing
    End Function
    The two items that I would like to achieve are:
    1. Getting a list of fieldnames on the form referenced
    2. Changing the field name (in this case, a textbox or checkbox) programmatically.
    However, I have not had any success in retrieving a list of available field names, nor have I been able to modify the name of the field. Any ideas?
    i.e. It would be nice one could say
    For i = 0 to acForm.[FieldCount]
         Set Field = jso.GetField(i)
         Print Field.Name
    Next i
    ...and
    Field.Name = "NewFieldName"
    I hope that helps to explain what I am trying to accomplish. Any ideas are appreciated. Thank you!

    Have you consulted the documentation in the SDK about what methods are available? It will show you how to get the list of fields and/or the proper count for iteration.
    IIRC you can't change the name via VBA

  • Change Tracker via Web Pane not working (when using multiple DF fields)

    All,
    We are using MDM 5.5 SP06, version 5.5.62.53
    I have configured the Change Tracker so that I can use it in the Data Manager Web pane. I also set the configuration options of the Data Manager for the "Web Pane URL for selected records" to this link, so everything should work fine (it is working for another reporistory with just one DF field in the main table).
    The main table (for which I want to track the changes on) has two DF fields. The first DF field of the main table is a look-up field (where the look-up table itself has two DF fields as well) and the second DF field of the main table is just a text field.
    The URL link to the Change Tracker makes use of the parameter: searchrecord=<f:n>, as described in the reference guide for MDM Console.
    When I select a record in the Record pane in the Data Manager and go to the Web Pane, then the Change Tracker is showing, but the change history for that record is not shown in the Change Tracker!!
    This is caused by the fact that the records in the History table are stored with the following information in the "record" field (example): 113786=1000010 - Enfa B.V, 100075. Appearantly this is a combination of the two DF fields of the main table, and because the first DF field is a look-up it shows the values of the DF fields of the look-up table as well (including the ID of that look-up record)!!
    I tried the following in the URL link: searchrecord=<f:n>,<f:n2>, but then the Change Tracker receives the following value (which is an invalid value): 1000010, Enfa B.V, 100075
    How can I configure the URL link in the Console in such a way that the Change Tracker recognizes the searchrecord parameter as a valid entry (because when you start Change Tracker in separate browser it expects value of e.g. 113786=1000010 - Enfa B.V, 100075 in the "record" search field, otherwise it does not find any records).
    Or do I need to change the DF fields and make an MDM-ID field to be the only DF field, and use that field in the searchrecord=<f:n> parameter???
    Has anyone any experiences with this? Any suggestions how to solve this issue?
    Thanks in advance,
    Marcel

    Hi,
    We are indeed tracking changes on the main table. It is the standard SRM-MDM Catalog repository where Supplier and Supplier Part Number are the DF fields of the main table. From standpoint of the datamodel these two DF fields are correct, since these two fields make up an unique record.
    Of course I can change the DF field and make the MDM-ID the DF field, but we want to stick as much as possible to the standard SRM-MDM Catalog!
    It would be better if the URL to the Change Tracker has additional parameters that can be filled (like the Record Contains field instead of the Record field) or that you could specify the MDM-ID as parameter (without having to change the DF fields of the main table) so that the Change Tracker knows exactly for which record we require the change history!
    I will investigate futher and see if we can live with the MDM-ID as the only DF field.
    Thanks anyhow for your reply.
    Regards,
    Marcel

  • IOS 8: The textbox to change the description field of the iCloud email account no longer exists

    The textbox to change the description of the iCloud email account that existed in all previous versions of iOS, and is available for all other types of email accounts under iOS 8, appears to have been removed.  Without this textbox, it is not possible to change the default description of "iCould", or to change a description that was set with a previous version of iOS.  The description field still exists, as the value that I set on a previous version of iOS is still being used by some of my iOS devices, but there is currently no way to change it via the current iOS 8 UI.  The description field is available to change for all other kinds of email accounts.

    Confimed.  And I hope they put it back soon.
    I used an iCloud backup to transfer everything on my iPhone 5s to my iPhone 6.  The (modified) description for my iCloud account transferred and appears the way I want it to appear on my iPhone 6.  However, it cannot be changed.
    Alternatively, I also have a new iPad Air 2 that I set up as a completely new iPad (i.e. I did not transfer anything from an older iPad).  The iPad shows the description for my iCloud account as the default: "iCloud."  It, too, cannot be changed.
    True, this is only a minor annoyance, but it would be less of an issue if Apple had not removed a feature that previously existed in iOS 7.
    I'm not sure if the removal was intentional or unintentional, but, again, I hope this gets fixed soon.  In the meantime, I would be interested in anyone can find a workaround.

  • Data missing in Crosstab report with calculated field via case when

    I use the Oracle 10g discoverer. When I create a crosstab report with a calculate field via function case when and put it as datapoint, some of the data is not showing. I tried to not use the case when function for the calculate field, then all the data show.
    I really do not the reason. Could anybody help me out with many thanks?

    Let me explain more.
    I have the original data below.
    Work order, Team, Hours_worked, date
    800001, S1, 5, 2012/01/01
    800001, S1, 15, 2012/01/10
    800001, S2, 4, 2012/01/04
    800002, S1, 3, 2012/01/15
    There are multipul records for the same work order, team on the same day or different.
    Finally I want to set the start date and end date as the parameter to create a crosstab report format like
    start date>=2012/01/01 and close date<=2012/01/05
    Team
    Total hours total hours within the range
    Work order S1 S2 ... S1 S2 ...
    800001 20 4 5 4
    800002 3 0 0 0
    in order to do it, I create two parameters independently start date and close date. Then I create a calculate field hours_worked_withinrange via
    Case when date>=:start date and date<=:end date then Hours_worked else 0 end
    This calculated field is correct in the tabular format report in discoverer desktop. But when I duplicate the list as crosstab. Some data is missing in crosstab data point.
    I checked once I change the calculate field defination not use case when. (For example, C1=hours_worked*2). Then everything runs correct.

  • Master-detail: detail field not displayed after changed by master field

    I want to use the Depends on item with Clear/refresh value functionality in a master detail situation. Within the same group it is no problem to use the setter method of a field to change a second field and then displaying this new value. But in the detail group, I can not select items from the master group as a depends on item.
    In the setter of the master field, the value in a field for each row in the detail (table layout) is updated. The only problem is that this updated value is not displayed, the old value doesn't change. When saving the changes, the displayed value is committed to the database. When de updated field is not displayed at all, the correct value is saved, so I know the detail field is updated.
    How can I make sure the displayed value in the detail is displayed after changeing a master field? I already gave the detail field the correct partial trigger.

    Wouter,
    I guese you don;t see the changed value when you display the detail item because after the depends on item update changed the detail item, JSF procesing continues and the detail table changes are sent to the server which will override again the detail item attriibute, resetting it to the old, still displayed value.
    So, the trick is to get PPR working. Make sure the partialTYriggers property of the detail item is set to the value of the id property of the master item. If it still doesn't work, try setting the partial triggers property on the table, instead of the individual item.
    Steven Davelaar,
    JHeadstart team

  • Cannot add hub-managed content type with external list lookup columns to a list -- Error:Id field is not set on the external data field

    This is a variation on the issue mentioned in this
    post
    We are using SP 2010 Content Hub to manage our content types.  On the content hub we've created a couple of exteranl lists, and then created some site columns as lookups against these lists.  We then added the columns to one of our content types
    and set it to publish.
    After the publishing job executed, I tried adding the content type (which now appears on the subscriber sites) to one of the document libraries on one of the subscriber sites.  When I did that it threw the following error:
    Microsoft.SharePoint.WebControls.BusinessDataListConfigurationException: Id field is not set on the external data field    
    at Microsoft.SharePoint.SPBusinessDataField.CreateIdField(SPAddFieldOptions op)     
    at Microsoft.SharePoint.SPBusinessDataField.OnAdded(SPAddFieldOptions op)     
    at Microsoft.SharePoint.SPFieldCollection.AddFieldAsXmlInternal(String schemaXml, Boolean addToDefaultView, SPAddFieldOptions op, Boolean isMigration, Boolean fResetCTCol)     
    at Microsoft.SharePoint.SPContentType.ProvisionFieldOnList(SPField field, Boolean bRecurAllowed)     
    at Microsoft.SharePoint.SPContentType.ProvisionFieldsOnList()     
    at Microsoft.SharePoint.SPContentType.DeriveContentType(SPContentTypeCollection cts, SPContentType& ctNew)     
    at Microsoft.SharePoint.SPContentTypeCollection.AddContentTypeToList(SPContentType contentType)     
    at Microsoft.SharePoint.SPContentTypeCollection.AddContentType(SPContentType contentType, Boolean updateResourceFileProperty, Boolean checkName, Boolean setNextChildByte)     
    at Microsoft.SharePoint.SPContentTypeCollection.Add(SPContentType contentType)     
    at Microsoft.SharePoint.ApplicationPages.AddContentTypeToListPage.Update(Object o, EventArgs e)     
    at System.Web.UI.WebControls.Button.OnClick(EventArgs e)     
    at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)     
    at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)     
    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)    b55297ed-717f-466d-8bdc-297b20344d3f
    I checked the external  content type configuration and it did specify an "id column".  Anyone know if what I am attempting to do is possible and if so, what special configurations are required?
    Thanks

    The issue is not External Content type or external list but the look up column.
    It's not possible to publish a look up column via the Content Type Hub.
    If you need to do this then an alternate way is to use a Managed Metadata column instead, otherwise you will have to implement this via a feature.
    Varun Malhotra
    =================
    If my post solves your problem could you mark the post as Answered or Vote As Helpful if my post has been helpful for you.

  • What key fields should i set in DSO extracting data from 2LIS_02_ITM

    hi experts
    i extract data from 2LIS_02_ITM into a DSO, i know the DSO isn't a must, becoz the 2LIS_02_ITM delta type is ABR, but i want to keep the info in change log.
    so, what the key fields should i set in the dso? just ebeln and ebelp is enough?
    hunger for ur advice and thanks a lot!

    If you extract ITM toa DSO you cannot maintain a log of every change....the data will come ....but when the data must be activated the reference of the ebelp ebeln will remain only a single record....if you want to maintain all the data you must create another field in extractor with you can difference all the changes for one single ebelp ebeln...
    Regards

  • Could not changed cost center field in document type RE - FSG

    Dear Experts,
    I would like to change 'cost center field' in act document type RE (invoice receipt) through transaction FB02
    I have changed the field of 'cost center' in field status group in OBC4 and OB41 (posting key 50 and 86)
    The field staus group both in OB41 and OBC4 are already set as 'optional entry' but field of cost center is still could not be changed/edit (grey area).
    Kindly advice
    Thank you.

    Hi Chandra,
    Can you please details the coding part if you can remember ..so that would be helping me lot...Since it's production issue , we have implement immd.
    Regards,
    Lalit
    Edited by: Lalit  Sharma on Dec 24, 2009 6:45 AM
    =======================
    This problem can be closed. I got the note.
    Edited by: Lalit  Sharma on Jan 12, 2010 12:50 AM

  • Wiki Server: how to change who "From" field in Mail

    I have Mail set up to receive an RSS feed from our Wiki Server and in the "From" field it comes up as "Workgroup: Search Results."
    Is there any way to change this, say to "Workgroup Intranet"?

    >
    Sukhi Singh wrote:
    > Hi
    > I want to change a Parameter field in Crystal report from YYYY-MM-DD format to DD/MM/YY format
    What do you mean by Crystal Report?  Are you sure you posted this to the correct forum?

  • Problem updating a date field via UnitOfWork - TopLink 9.0.3

    Hello,
    we want to change an exisiting application that employs TopLink 9.0.3, Build 423.
    The data is stored in an Oracle 9.2.0.6.
    The specific table has a composite primary key consisting of four fields.
    I can easily create a new Object (foo)
    uow.registerNewObject(foo)
    uow.commit()
    and see the results in the database.
    If I obtain an exising Object (bar) and change an integer
    bar = (Bar) Session.readObject(Bar.class, expr);
    cloneBar = (Bar) uow.registerObject(bar);
    cloneBar.setSomething(42);
    uow.commit()
    everything is fine.
    But if I dare to change a Date field
    cloneBar.setSomethingElse(cal.getTime());
    then
    uow.hasChanges()
    returns true
    but the update does not happen. It is neither logged nor is the data changed in the database.
    Is this a known bug?
    What have I done wrong?
    How can I avoid using hard-coded SQL to update my Bar object?
    Bye,
    Stephan

    Hello,
    it is very disturbing, but I finally found the reason for this problem.
    After decompiling the Project class file (we have no source code of this third-party library), I saw that the mapping for this specific field is set to "readOnly".
    I did not know that TopLink is able to have specific fields "readOnly" and others "readWrite", but it can handle this!
    So it seems that the behaviour is not a bug but a feature :-(
    We can change the mapping before creating the session, with the result that the field is updatable.
    Have a nice day.

  • Changing not possible; field is read-only

    Hello,
    I need update Expected Value in Opportunity.
    Expected Value is bound Opportunity.SalesForecast.ExpectedRevenueAmount.content.
    When I try to update in adsl, "Changing not possible; field is read-only" error appears in frontend to the user.
    Thanks!

    Hi Rodrigo Mathias,Not an answer to your post just to share my problem
    Seems Opportunity has a lot of problems. As in my case i am trying to code in BeforeSave method that when ever the opportunity gets create by code i have to poppulate my CUSTOM Invonved Party ( i have created custom party role ).
    And i have passed partykey.partyId.content and RoleCode but when i click on save it gives me the error about Role Category!
    now when debugged that all Parties ( i debugged and checked whole collection) had the Role category every party from that collection had the Role category associated!
    So i tried to add r
    ole category by code! but that is also public write access set as FALSE!
    So finally i again opened the book for clod , and a line is specificaly written that PartyID node will not be used after 1402 there will be separate node PartyNAme where u can pass partyid , name or email!
    but unfortunately that is also not available in the opportunity BO!
    So i am also kind of stuck!
    Btw one thing i would like to mention is when u try to maintain your custom role in opportunity manually it works and data gets saved!
    Regards,
    Dhruvin

  • Unable to update Level field in Forecast Set

    The Level field in Forecast Set was previously set to "Item", but we would like to change the value to "Customer". However, the form is preventing us from changing the value even though the forecast set is empty - all forecasts have been deleted. Has anyone encountered this issue and was able to find a solution?
    Cheers!

    Do other Forecast sets have the same issue or is this the only Forecast set having this issue?
    If you have not instanlled OM or AR, then you can only define and consume Forecasts at 'Item' level.
    Regards
    Siva G

  • Dynamically change binding of field

    Hello all,
    I am attempting to develop a form in which the binding of the fields is not yet known at design time.
    What I am trying to do is the following:
    In the "initialize" event of the form, I have typed the following:
    HEADER.FIELD.bind.ref = "$record.DATA_IN.SUBFORM.DATA[1].NAME";
    HEADER.FIELD.bind.match = "dataRef";
    "HEADER" is a subform with a text field called "FIELD" in it. What happens is: plain nothing - although there is data in the specified node, the fields remains empty.
    If I comment out the two lines and put the "$record.DATA_IN.SUBFORM.DATA[1].NAME" directly to the "binding" property, it works just fine. Setting the default binding to "normal" and trying to set it via code does not...
    Any hints? Am I missing some important step?
    Thanks
    Daniel Sattler

    Hello,
    I was trying to utilize the same to dynamically bind a text field of a row in a table. The row has been dynamically created at runtime (using instance manager - that is working). Here is the code I used inside the click event of the button after the row instance is created:
    $template.data.resolveNode("relocation.tablesubform.addtable.datarow[1]").country_data.bin d.ref
    = "$record.COUNTRY.DATA[*].FIELD";
    $template.data.resolveNode("relocation.tablesubform.addtable.datarow[1]").country_data.bin d.match= "dataRef";
    And the code used in ready form event of the button:
    $form.remerge();
    But for some reason the text field is not getting bound. Could you please advise?
    Thanks
    Sachin

  • Outlook not sync contacts with changed "file as" field?

    I am syncing contacts and calendar from Outlook on my office PC (and everything else from Mac at home). I have a very large contact list and have noticed that a number of key contacts have not synced. It appears that any contacts with a changed "file as" field have not been syned (e.g. contact entry of "Daniel Smith" with "file as" field altered in Outlook to show "Dan Smith" does not show anywhere on iPhone). Needless to say, these are actually the contacts that I use most often so I'm hoping to find a solution.
    On a related point, it's hard to determine exactly how many contacts are not syncing b/c I can't find anyplace on the iPhone or in iTunes that lists shows info on the number of contacts (so I can't compare to my count in Outlook).
    Has anyone else experienced this problem? Are there any known solutions or work-arounds? (I'm hoping to avoid a full export, clean-up, and import to iPhone through the Mac Address Book or similar b/c I'm concerned that in then trying to sync w/ Outlook I'd get duplicates. Also, my contact list has thousands of contacts so it would be very dedious. My current work-around is to still carry my Treo in my briefcase, which is not ideal).
    Thanks in advance for any help.

    boynsea: Thanks for the input, but isn't the IMAP aspect of Outlook limited to the way one can connect to an Exchange server for e-mail? I've been successful in getting the IMAP connection for e-mail working. Contacts and calendar are designed to sync when physically docked with the computer rather than over-the-air; I know, if something like exchange activesync is ever licensed for iPhone then the calendar can be updated over-the-air, but I suspect that contacts will always be synced only when docked (which is how my Treo was set up).
    Anyway, I did test my theory about the "file-as" field by changing a few contacts back to their default display and now they sync just fine. I really don't want to have to do this for all contacts, and can't actually tell how many are involved since I haven't found anyplace that the number of contacts is listed. Also, does anyone know if there is a readily accessible syncronization log that can be checked? That might show those contacts that are rejected.
    Thanks.

Maybe you are looking for

  • Printing problems - Network host is busy, will retry in 30 seconds . . .

    Configuration: 3 machines on the network 1. iMac with Snow Leopard 10.6.8 (wired connection) 2. Ubuntu Linux 11.04 (Natty Narwhal) server on IA64 with CUPS 1.4.6 (machine is called tusko) 3. MacBookPro with Snow Leopard 10.6.7 (wireless connection) 4

  • Online number

    I purchased an online number to replace my normal landline, and it is not working after a day, I was not asked to verify it, the system said it would be up and running immediatly, I ring the number from a land line, it rings once then goes into an en

  • In ALV output, select row(s), How can we know which record it has selected?

    Hi Experts, In ALV output, there are 10 records (rows) displayed. I want to select specific row (or rows) for mass printing ( I need to assign respective smartform for selected row(s)). How the system (or my self) will recognize that which record it

  • DVD not playing on player

    I am new to DVD Studio Pro, I created a project and clicked build and format. I then put the DVD-R into my player to make sure it would work and no luck. I tried to emulate and still nothing. I can simulate and it works perfectly fine. Any tips or su

  • Macbook pro superdrive issues after 2.1 firmware update

    i have the 07 aluminum body macbook pro (non inibody) and after updating to snow leopard the drive started only reading certain disc and cds and spitting others back out. this is bogus because apple does not want to take responsibility in messing up