Adding a JPanel from one class to another Class (which extends JFrame)

Hi everyone,
So hopefully I go about this right, and I can figure out what I'm doing wrong here. As an exercise, I'm trying to write a Tic-Tac-Toe (TTT) game. However, in the end it will be adaptable for different variations of TTT, so it's broken up some. I have a TTTGame.java, and TTTSquareFrame.java, and some others that aren't relavent.
So, TTTGame:import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import joshPack.jUtil.*;
public class TTTGame extends JFrame
     private Integer sides = 3;
     private TTTSquareFrame mainSquare;
     private TTTGame newGame;
     private Container contents;
     private JPanel mainSquarePanel, addPanel;
     public static void main(String [] args)
          TTTGame newGame = new TTTGame();
          newGame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
     public TTTGame()
          super("Tic-Tac-Toe");
          contents = getContentPane();
          contents.setLayout(new FlowLayout());
          addPanel = startSimple();
          if(!addPanel.isValid())
               System.out.println("Something's wrong");
          contents.add(addPanel);
          setSize(300, 300);
          setVisible(true);
     public JPanel startSimple()
          mainSquare = new TTTSquareFrame(sides);
          mainSquarePanel = mainSquare.createPanel(sides);
          return mainSquarePanel;
}and TTTSquareFrame:import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import joshPack.jUtil.Misc;
public class TTTSquareFrame
     private JPanel squarePanel;
     private JButton [] squares;
     private int square, index;
     public TTTSquareFrame()
          System.out.println("Use a constructor that passes an integer specifying the size of the square please.");
          System.exit(0);
     public TTTSquareFrame(int size)
     public JPanel createPanel(int size)
          square = (int)Math.pow(size, 2);
          squarePanel = new JPanel();
          squarePanel.setLayout(new GridLayout(3,3));
          squares = new JButton[square];
          System.out.println(MIN_SIZE.toString());
          for(int i = 0; i < square; i++)
               squares[i] = new JButton();
               squares.setRolloverEnabled(false);
               squares[i].addActionListener(bh);
               //squares[i].setMinimumSize(MIN_SIZE);
               squares[i].setVisible(true);
               squarePanel.add(squares[i]);
          squarePanel.setSize(100, 100);
          squarePanel.setVisible(true);
          return squarePanel;
}I've successfully added panels to JFrame within the same class, and this is the first time I'm modularizing the code this way. The issue is that the frame comes up blank, and I get the message "Something's wrong" and it says the addPanel is invalid. Originally, the panel creation was in the constructor for TTTSquareFrame, and I just added the mainSquare (from TTTGame class) to the content pane, when that didn't work, I tried going about it this way. Not exactly sure why I wouldn't be able to add the panel from another class, any help is greatly appreciated.
I did try and cut out code that wasn't needed, if it's still too much let me know and I can try and whittle it down more. Thanks.

Yea, sorry 'bout that, I just cut out the parts of the files that weren't relevant but forgot to compile it just to make sure I hadn't left any remnants of what I had removed. For whatever it's worth, I have no idea what changed, but something did and it is working now. Thanks for your help, maybe next time I'll post an actual question that doesn't somehow magically solve itself.
EDIT: Actually, sorry, I've got the panel working now, but it's tiny. I've set the minimum size, and I've set the size of the panel, so...why won't it respond to that? It almost looks like it's being compressed into the top of the panel, but I'm not sure why.
I've compressed the code into:
TTTGame.java:
import java.awt.*;
import javax.swing.*;
public class TTTGame extends JFrame
     private Integer sides = 3;
     private TTTSquareFrame mainSquare;
     private TTTGame newGame;
     private Container contents;
     private JPanel mainSquarePanel, addPanel;
     public static void main(String [] args)
          TTTGame newGame = new TTTGame();
          newGame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
     public TTTGame()
          super("Tic-Tac-Toe");
          contents = getContentPane();
          contents.setLayout(new FlowLayout());
          mainSquare = new TTTSquareFrame(sides.intValue());
          contents.add(mainSquare);
          setSize(400, 400);
          setVisible(true);
}TTTSquareFrame.java
import java.awt.*;
import javax.swing.*;
public class TTTSquareFrame extends JPanel
     private JButton [] squares;
     private int square, index;
     private final Dimension testSize = new Dimension(50, 50);
     public TTTSquareFrame(int size)
          super();
          square = (int)Math.pow(size, 2);
          super.setLayout(new GridLayout(size, size));
          squares = new JButton[square];
          for(int i = 0; i < square; i++)
               squares[i] = new JButton();
               squares.setMinimumSize(testSize);
               squares[i].setVisible(true);
               super.add(squares[i]);
          setSize(200, 200);
          setVisible(true);
I've made sure the buttons are smaller than the size of the panel, and the panel is smaller than the frame, so...
Message was edited by:
macman104

Similar Messages

  • How can I transfer data from one iPhone to another iPhone which is already set up?

    I have an old phone that I want to transfer data to. The phone is set up with previous data. How do I transfer current data to it?

    if the iphone have not been synced with another computer then just sync it with yours
    if it have then you cant syncing it with your computer would then clear the iphone and adding the info from your itunes to it

  • What's the exact trigger for when updating/inserting/deleting data from one DB to another DB which contains same info?

    Hi guys,
    I have created a copy of the AdventureWorks2012 DB called AdventureWorks2012_new on the same instance.
    I have created the following trigger below but my friend who is a DBA told me that this is not correct and I should be using the inserted table when creating this trigger. I would like AdventureWorks2012_new DB to be updating/inserting/deleting data from
    the same tables that have been updated/inserted/deleted in the AdventureWorks2012 DB. How exactly should I do this for all the tables in the whole database ? What I have written below is just for one of the tables, is there a quicker way to do it for all tables
    in this DB so that it performs the actions mentioned above, automatically ? Help would be greatly appreciated so I can understand how this works, thanks
    CREATE TRIGGER [HumanResources].[tr_HumanResources_AfterUpdate]
    ON [AdventureWorks2012].[HumanResources].[Department]
    AFTER UPDATE
    AS
    BEGIN
    SET NOCOUNT ON;
    UPDATE AdventureWorks2012_new.HumanResources.Department
    SET Name = t2.Name,
    GroupName = t2.GroupName,
    ModifiedDate = t2.ModifiedDate
    FROM AdventureWorks2012.HumanResources.Department AS t2
    INNER JOIN AdventureWorks2012_new.HumanResources.Department AS t1
    ON t2.DepartmentID = t1.DepartmentID
    END

    For insert it's easy:
    CREATE TRIGGER [HumanResources].[tr_HumanResources_AfterInsert]
    ON [AdventureWorks2012].[HumanResources].[Department]
    AFTER INSERT
    AS
    BEGIN
    SET NOCOUNT ON;
    Insert INTO AdventureWorks2012_new.HumanResources.Department
    (DepartmentID, Name, GroupName, ModifiedDate)
    SELECT DepartmentID, Name, GroupName, ModifiedDate
    FROM Inserted;
    END
    I didn't verify column names, so you may need to make sure to use correct column names for that table.
    Setting replication is a bit advanced topic although BOL is clear and you may start here
    http://technet.microsoft.com/en-us/library/ms151198.aspx
    If it will be complicated for you, you can ask extra questions in the MSDN Replication forum.
    For every expert, there is an equal and opposite expert. - Becker's Law
    My blog
    My TechNet articles

  • Home Sharing drops when I move from one router to another on an extended network???  HELP.

    I have an airport extreme as my main router.  I bought an airport express to get a stronger signal across the house.  The express is set to bridge mode.  When I start playing a movie using home sharing near one wireless router and move to a location near the other router, the home sharing drops.  I have to return to my computer and close itunes and reopen to get it to work again.  Very frustrating.  I have to reset iTunes constantly.  Please help.
    Thanks,
    JOE

    Ahhhhh. I was running in circles not being familiar with MacOSX. However, I seem to have accomplished what I wanted. I hadn't noticed that I could delete the other account by clicking the lock icon. Once I deleted it the migrated account became the default autologin account and all is well now. Cool. Pretty simple.

  • Send notification from one MBean to another

    How do you send notifications from one MBean to another, with both extending NotificationBroadcasterSupport?
    I don't mean using the POJO classes themselves, but sending a notification to the managed resource (from the ObjectName) of the other. I figured you'd perhaps add it to the Notification subclass you send, but I don't know how in the NotificationListener you'd send it to another ObjectName.
    What I'm trying to do is see perform an operation in one MBean in JConsole and see a message added to another MBean's notifications list. How might I be able to do this?
    Thanks.

    Hi,
    If you want MBean A to receive notifications from MBean B, then you only need MBean A to register as a notification listener with MBean B,
    Where's the problem?
    -- daniel

  • LOCAL Structure to be copied from one query to another query

    Hello all,
    In our query we have created a structure locally....
    we have to copy the same locally created structure from one query to another query which is on the same multiprovider.
    We do not want to make the structure global.
    Can anyone suggest some method to achieve this!

    For copiying structures fom query to another you have to do it global. After that you can do click on right button on the structure when added to your query and choose "eliminate reference" this does further changes in the structure were local for that query.

  • Problem in Navigation from one tab to another

    Hi All,
    In my forms, I have three tabs. In one tab, i have a set of records displayed(like table) in which all columns are bound to a table. I want to sort the records in the tab based on one column. So i wrote the following code in WHEN-TAB-PAGE-CHANGED trigger in form level. It works fine when i click on the particular tab. But when i try to navigate from one tab to another tab which i want to sort, the records in the tab are not sorted. The buton i used to navigate from one tab to another is tab in key board.
    DECLARE
    l_order_by VARCHAR2 (70) := '(select code from emp)';
    BEGIN
    IF (:SYSTEM.tab_new_page) = 'PAGE1' OR :SYSTEM.cursor_block = 'BLOCK1' THEN
    SET_BLOCK_PROPERTY ('BLOCK1', order_by, l_order_by);
    GO_BLOCK ('BLOCK1');
    EXECUTE_QUERY;
    END IF;
    END;
    please help asap.
    Thanks,
    Gopi.

    Gopi,
    Based on your sample code, the only data block that you are modifying the sort on is "BLOCK1". Rather than combine all of your logic into the When-Tab-Page-Changed (WTPC) trigger, I suggest you simply use the WTPC trigger to set the cursor to the block associated with the selected tab page and then set your block properties and query your block in the When-New-Block-Instance (WNBI) trigger for each block. For example:
    /* Sample When-Tab-Page-Changed trigger */
    DECLARE
       tp_nm    VARCHAR2(30);
    BEGIN
       tp_nm := :SYSTEM.TAB_NEW_PAGE;
       IF ( tp_nm = 'PAGE1' ) THEN
          Go_Block('BLOCK1');
       ELSIF ( tp_nm = 'PAGE2' ) THEN
          Go_Block('BLOCK2');
       ELSIF ( tp_nm = 'PAGE3' ) THEN
          Go_Block('BLOCK3');
       END IF;
    END;Bare in mind, that clicking on a Tab Page does not move the navigation cursor the block associated with the tab page displayed. You must manually perform the navigation as demonstrated above. Now, in your WNBI triggers you would write something like the following:
    /* Sample When-New-Block-Instance trigger */
    DECLARE
       l_order_by VARCHAR2 (70) := '(select code from emp)';
    BEGIN
       SET_BLOCK_PROPERTY ('BLOCK1', order_by, l_order_by);
       EXECUTE_QUERY;
    END;You could combine this code into the WTPC trigger if you don't want to seperate the code and orgainze it according to your data blocks. The key, however, is that cursor navigation doesn't occur when you click on a tab, you have to perform the navigation yourself.
    Hope this helps,
    Craig B-)
    If someone's response is helpful or correct, please mark it accordingly.

  • How to copy a query from one infoprovider to another infoprovider

    Hi Experts,
    Could anyone suggest me on how to copy a particular query from one infoprovider to another infoprovider which are identical and have the same objects in them.
    Thanx in advance
    Lalit

    Hi Lalith,
    Use the Transaction RSZC and specify the - > Source InfoCube  -> Target InfoCube and select the queries  you want to copy.
    Hope it helps
    Regards
    Srikanth

  • Adding multiple same-name nodes from one xml into another

    Hi,
    Following on from my question the other day (Adding multiple different nodes from one xmltype into another), I now have a slightly more complex requirement that I cannot work out where to start, assuming that it's something that can reuse some/all of yesterday's work (thanks again, odie_63!). ETA: I'm on 11.2.0.3
    So, here's the (slightly amended) xml along with yesterday's solution:
    with sample_data as (select xmltype('<root>
                                           <xmlnode>
                                             <subnode1>val1</subnode1>
                                             <subnode2>val2</subnode2>
                                           </xmlnode>
                                           <xmlnode>
                                             <subnode1>val3</subnode1>
                                             <subnode2>val4</subnode2>
                                           </xmlnode>
                                         </root>') xml_to_update,
                                xmltype('<a>
                                           <b>valb</b>
                                           <c>valc</c>
                                           <d>
                                             <d1>vald1</d1>
                                             <d2>vald2</d2>
                                           </d>
                                           <e>vale</e>
                                           <f>valf</f>
                                           <g>
                                             <g1>valg1</g1>
                                             <g2>valg2</g2>
                                           </g>
                                           <h>
                                             <h1>valh1</h1>
                                             <h2>valh2</h2>
                                           </h>
                                           <multinode>
                                             <name>fred</name>
                                             <type>book</type>
                                             <head>1</head>
                                           </multinode>
                                           <multinode>
                                             <name>bob</name>
                                             <type>car</type>
                                             <head>0</head>
                                           </multinode>                                        
                                         </a>') xml_to_extract_from
                          from   dual)
    select xmlserialize(document
               xmlquery(
                 'copy $d := $old
                  modify (
                    insert node element extrainfo {
                      $new/a/b
                    , $new/a/d
                    , $new/a/f
                    , $new/a/h
                    } as first into $d/root
                  return $d'
                 passing sd.xml_to_update as "old"
                       , sd.xml_to_extract_from as "new"
                 returning content
             indent
    from sample_data sd;
    That gives me:
    <root>
      <extrainfo>
        <b>valb</b>
        <d>
          <d1>vald1</d1>
          <d2>vald2</d2>
        </d>
        <f>valf</f>
        <h>
          <h1>valh1</h1>
          <h2>valh2</h2>
        </h>
      </extrainfo>
      <xmlnode>
        <subnode1>val1</subnode1>
        <subnode2>val2</subnode2>
      </xmlnode>
      <xmlnode>
        <subnode1>val3</subnode1>
        <subnode2>val4</subnode2>
      </xmlnode>
    </root>
    However, I now need to add in a set of new nodes based on information from the <multinode> nodes, something like:
    <root>
      <extrainfo>
        <b>valb</b>
        <d>
          <d1>vald1</d1>
          <d2>vald2</d2>
        </d>
        <f>valf</f>
        <h>
          <h1>valh1</h1>
          <h2>valh2</h2>
        </h>
        <newnode>
          <name>fred</name>
          <type>book</type>
        </newnode>
        <newnode>
          <name>bob</name>
          <type>car</type>
        </newnode>
      </extrainfo>
      <xmlnode>
        <subnode1>val1</subnode1>
        <subnode2>val2</subnode2>
        <type>book</type>
      </xmlnode>
      <xmlnode>
        <subnode1>val3</subnode1>
        <subnode2>val4</subnode2>
        <type>car</type>
      </xmlnode>
    </root>
    If it's easier, I *think* we would be ok with something like:
    <newnode>
      <type name="fred">book</type>
      <type name="bob">car</type>
    </newnode>
    The closest I've come is:
    with sample_data as (select xmltype('<root>
                                           <xmlnode>
                                             <subnode1>val1</subnode1>
                                             <subnode2>val2</subnode2>
                                           </xmlnode>
                                           <xmlnode>
                                             <subnode1>val3</subnode1>
                                             <subnode2>val4</subnode2>
                                           </xmlnode>
                                         </root>') xml_to_update,
                                xmltype('<a>
                                           <b>valb</b>
                                           <c>valc</c>
                                           <d>
                                             <d1>vald1</d1>
                                             <d2>vald2</d2>
                                           </d>
                                           <e>vale</e>
                                           <f>valf</f>
                                           <g>
                                             <g1>valg1</g1>
                                             <g2>valg2</g2>
                                           </g>
                                           <h>
                                             <h1>valh1</h1>
                                             <h2>valh2</h2>
                                           </h>
                                           <multinode>
                                             <name>fred</name>
                                             <type>book</type>
                                             <head>1</head>
                                           </multinode>
                                           <multinode>
                                             <name>bob</name>
                                             <type>car</type>
                                             <head>0</head>
                                           </multinode>                                        
                                         </a>') xml_to_extract_from
                          from   dual)
    select xmlserialize(document
               xmlquery(
                 'copy $d := $old
                  modify (
                    insert node element extrainfo {
                      $new/a/b
                    , $new/a/d
                    , $new/a/f
                    , $new/a/h
                    , element newnode {
                                       $new/a/multinode/name
                                       ,$new/a/multinode/type
                    } as first into $d/root
                  return $d'
                 passing sd.xml_to_update as "old"
                       , sd.xml_to_extract_from as "new"
                 returning content
             indent
             ) fred
    from sample_data sd;
    Which produces:
    <newnode>
      <name>fred</name>
      <name>bob</name>
      <type>book</type>
      <type>car</type>
    </newnode>
    - obviously not right!
    Can anyone provide any hints? I've tried searching for similar examples, but I mustn't be putting in the right search terms or something!

    odie_63 wrote:
    or, similarly, to get the alternate output :
    copy $d := $old
    modify (
      insert node element extrainfo {
        $new/a/b
      , $new/a/d
      , $new/a/f
      , $new/a/h
      , element newnode {
          for $i in $new/a/multinode
          return element type {
            attribute name {data($i/name)}
          , data($i/type)
      } as first into $d/root
    return $d
    So we're going with the second method, but I've discovered that the "$i/name" node is not always present. When that happens, I would like to use a default value (for example, "george"). I promise I've searched and searched, but I'm completely failing to turn up anything that sounds remotely like what I'm after (seriously, I can't believe my google-fu sucks this badly!).
    Is there a simple way of doing it? The only thing that I've found that looks vaguely relevant is "declare default namespace...." but I'm not sure that that's the correct thing to use, or if it is, how I'm supposed to reference it when populating the attribute value.

  • Passing a parameter from one class to another class in the same package

    Hi.
    I am trying to pass a parameter from one class to another class with in a package.And i am Getting the variable as null every time.In the code there is two classes.
    i. BugWatcherAction.java
    ii.BugWatcherRefreshAction.Java.
    We have implemented caching in the front-end level.But according to the business logic we need to clear the cache and again have to access the database after some actions are happened.There are another class file called BugwatcherPortletContent.java.
    So, we are dealing with three java files.The database interaction is taken care by the portletContent.java file.Below I am giving the code for the perticular function in the bugwatcherPortletContent.java:
    ==============================================================
    public Object loadContent() throws Exception {
    Hashtable htStore = new Hashtable();
    JetspeedRunData rundata = this.getInputData();
    String pId = this.getPorletId();
    PortalLogger.logDebug(" in the portlet content: "+pId);
    pId1=pId;//done by sraha
    htStore.put("PortletId", pId);
    htStore.put("BW_HOME_URL",CommonUtil.getMessage("BW.Home.Url"));
    htStore.put("BW_BUGVIEW_URL",CommonUtil.getMessage("BW.BugView.Url"));
    HttpServletRequest request = rundata.getRequest();
    PortalLogger.logDebug(
    "BugWatcherPortletContent:: build normal context");
    HttpSession session = null;
    int bugProfileId = 0;
    Hashtable bugProfiles = null;
    Hashtable bugData = null;
    boolean fetchProfiles = false;
    try {
    session = request.getSession(true);
    // Attempting to get the profiles from the session.
    //If the profiles are not present in the session, then they would have to be
    // obtained from the database.
    bugProfiles = (Hashtable) session.getAttribute("Profiles");
    //Getting the selected bug profile id.
    String bugProfileIdObj = request.getParameter("bugProfile" + pId);
    // Getting the logged in user
    String userId = request.getRemoteUser();
    if (bugProfiles == null) {
    fetchProfiles = true;
    if (bugProfileIdObj == null) {
    // setting the bugprofile id as -1 indicates "all profiles" is selected
    bugProfileIdObj =(String) session.getAttribute("bugProfileId" + pId);
    if (bugProfileIdObj == null) {
    bugProfileId = -1;
    else {
    bugProfileId = Integer.parseInt(bugProfileIdObj);
    else {
    bugProfileId = Integer.parseInt(bugProfileIdObj);
    session.setAttribute(
    ("bugProfileId" + pId),
    Integer.toString(bugProfileId));
    //fetching the bug list
    bugData =BugWatcherAPI.getbugList(userId, bugProfileId, fetchProfiles);
    PortalLogger.logDebug("BugWatcherPortletContent:: got bug data");
    if (bugData != null) {
    Hashtable htProfiles = (Hashtable) bugData.get("Profiles");
    } else {
    htStore.put("NoProfiles", "Y");
    } catch (CodedPortalException e) {
    htStore.put("Error", CommonUtil.getErrMessage(e.getMessage()));
    PortalLogger.logException
    ("BugWatcherPortletContent:: CodedPortalException!!",e);
    } catch (Exception e) {
    PortalLogger.logException(
    "BugWatcherPortletContent::Generic Exception!!",e);
    htStore.put(     "Error",CommonUtil.getErrMessage(ErrorConstantsI.GET_BUGLIST_FAILED));
    if (fetchProfiles) {
    bugProfiles = (Hashtable) bugData.get("Profiles");
    session.setAttribute("Profiles", bugProfiles);
    // putting the stuff in the context
    htStore.put("Profiles", bugProfiles);
    htStore.put("SelectedProfile", new Integer(bugProfileId));
    htStore.put("bugs", (ArrayList) bugData.get("Bugs"));
    return htStore;
    =============================================================
    And I am trying to call this function as it can capable of fetching the data from the database by "getbugProfiles".
    In the new class bugWatcherRefreshAction.java I have coded a part of code which actually clears the caching.Below I am giving the required part of the code:
    =============================================================
    public void doPerform(RunData rundata, Context context,String str) throws Exception {
    JetspeedRunData data = (JetspeedRunData) rundata;
    HttpServletRequest request = null;
    //PortletConfig pc = portlet.getPortletConfig();
    //String userId = request.getRemoteUser();
    /*String userId = ((JetspeedUser)rundata.getUser()).getUserName();//sraha on 1/4/05
    String pId = request.getParameter("PortletId");
    PortalLogger.logDebug("just after pId " +pId);  */
    //Calling the variable holding the value of portlet id from BugWatcherAction.java
    //We are getting the portlet id here , through a variable from BugWatcherAction.java
    /*BugWatcherPortletContent bgAct = new BugWatcherPortletContent();
    String portletID = bgAct.pId1;
    PortalLogger.logDebug("got the portlet ID in bugwatcherRefreshAction:---sraha"+portletID);*/
    // updating the bug groups
    Hashtable result = new Hashtable();
    try {
    request = data.getRequest();
    String userId = ((JetspeedUser)data.getUser()).getUserName();//sraha on 1/4/05
    //String pId = (String)request.getParameter("portletId");
    //String pId = pc.getPorletId();
    PortalLogger.logDebug("just after pId " +pId);
    PortalLogger.logDebug("after getting the pId-----sraha");
    result =BugWatcherAPI.getbugList(profileId, userId);
    PortalLogger.logDebug("select the new bug groups:: select is done ");
    context.put("SelectedbugGroups", profileId);
    //start clearing the cache
    ContentCacheContext cacheContext = getCacheContext(rundata);
    PortalLogger.logDebug("listBugWatcher Caching - removing markup content - before removecontent");
    // remove the markup content from cache.
    PortletContentCache.removeContent(cacheContext);
    PortalLogger.logDebug("listBugWatcher Caching-removing markup content - after removecontent");
    //remove the backend content from cache
    CacheablePortletData pdata =(CacheablePortletData) PortletCache.getCacheable(PortletCacheHelper.getUserHandle(((JetspeedUser)data.getUser()).getUserName()));
    PortalLogger.logDebug("listBugWatcher Caching User: " +((JetspeedUser)data.getUser()).getUserName());
    PortalLogger.logDebug("listBugWatcher Caching pId: " +pId);
    if (pdata != null)
    // User's data found in cache!
    PortalLogger.logDebug("listBugWatcher Caching -inside pdata!=null");
    pdata.removeObject(PortletCacheHelper.getUserPortletHandle(((JetspeedUser)data.getUser()).getUserName(),pId));
    PortalLogger.logDebug("listBugWatcher Caching -inside pdata!=null- after removeObject");
    PortalLogger.logDebug("listBugWatcher Caching -finish calling the remove content code");
    //end clearing the cache
    // after clearing the caching calling the data from the database taking a fn from the portletContent.java
    PortalLogger.logDebug("after clearing cache---sraha");
    BugWatcherPortletContent bugwatchportcont = new BugWatcherPortletContent();
    Hashtable httable= new Hashtable();
    httable=(Hashtable)bugwatchportcont.loadContent();
    PortalLogger.logDebug("after making the type casting-----sraha");
    Set storeKeySet = httable.keySet();
    Iterator itr = storeKeySet.iterator();
    while (itr.hasNext()) {
    String paramName = (String) itr.next();
    context.put(paramName, httable.get(paramName));
    PortalLogger.logDebug("after calling the databs data from hashtable---sraha");
    } catch (CodedPortalException e) {
    PortalLogger.logException("bugwatcherRefreshAction:: Exception- ",e);
    context.put("Error", CommonUtil.getErrMessage(e.getMessage()));
    catch (Exception e) {
    PortalLogger.logException("bugwatcherRefreshAction:: Exception- ",e);
    context.put(     "Error",CommonUtil.getErrMessage(ErrorConstantsI.EXCEPTION_CODE));
    try {
    ((JetspeedRunData) data).setCustomized(null);
    if (((JetspeedRunData) data).getCustomized() == null)
    ActionLoader.getInstance().exec(data,"controls.EndCustomize");
    catch (Exception e)
    PortalLogger.logException("bugwatcherRefreshAction", e);
    ===============================================================
    In the bugwatcher Action there is another function called PostLoadContent.java
    here though i have found the portlet Id but unable to fetch that in the bugWatcherRefreshAction.java . I am also giving the code of that function under the bugWatcherAction.Java
    ================================================
    // Get the PortletData object from intermediate store.
    CacheablePortletData pdata =(CacheablePortletData) PortletCache.getCacheable(PortletCacheHelper.getUserHandle(
    //rundata.getRequest().getRemoteUser()));
    ((JetspeedUser)rundata.getUser()).getUserName()));
    pId1 = (String)portlet.getID();
    PortalLogger.logDebug("in the bugwatcher action:"+pId1);
    try {
    Hashtable htStore = null;
    // if PortletData is available in store, get current portlet's data from it.
    if (pdata != null) {
    htStore =(Hashtable) pdata.getObject(     PortletCacheHelper.getUserPortletHandle(
    ((JetspeedUser)rundata.getUser()).getUserName(),portlet.getID()));
    //Loop through the hashtable and put its elements in context
    Set storeKeySet = htStore.keySet();
    Iterator itr = storeKeySet.iterator();
    while (itr.hasNext()) {
    String paramName = (String) itr.next();
    context.put(paramName, htStore.get(paramName));
    bugwatcherRefreshAction bRefAc = new bugwatcherRefreshAction();
    bRefAc.doPerform(pdata,context,pId1);
    =============================================================
    So this is the total scenario for the fetching the data , after clearing the cache and display that in the portal.I am unable to do that.Presently it is still fetching the data from the cache and it is not going to the database.Even the portlet Id is returning as null.
    I am unable to implement that thing.
    If you have any insight about this thing, that would be great .As it is very urgent a promt response will highly appreciated.Please send me any pointers or any issues for this I am unable to do that.
    Please let me know as early as possible.
    Thanks and regards,
    Santanu Raha.

    Have you run it in a debugger? That will show you exactly what is happening and why.

  • Adding Data From One Table to Another

    Now, this doesn't strike me as a particularly complex problem, but I've either strayed outside the domain of Numbers or I'm just not looking at the problem from the right angle. In any case, I'm sure you guys can offer some insight.
    What I'm trying to do is, essentially, move data from one table to another. One table is a calendar, a simple two column 'date/task to be completed' affair, the other is a schedule of jogging workouts, i.e, times, distances. Basically, I'm trying to create a formula that copies data from the second table onto the first but only for odd days of the week, excepting Sundays (and assuming Monday as the start of the week). Now, this isn't the hard part, I can do that. The problem comes when I replicate the formula down the calendar. Even on the days when the 'if' statement identifies it as an 'even day', the cell reference to the appropriate workout on the second table is incremented, so when it comes to the next 'odd day', it has skipped a workout.
    I can't seem to see any way of getting it to specifically copy the NEXT line in the second table, and not the corresponding line.
    This began as a distraction to try and organise my running so I could see at a glance what I had to do that day and track my progress, but now it's turned into an obsession. SURELY there's a solution?
    Cheers.

    Hi Sealatron,
    Welcome to Apple Discussions and the Numbers '09 forum.
    Several possible ways to move the data occur to me, but the devil's in the details of how the data is currently arranged.
    Is it
    • a list of three workouts, one for each of Monday, Wednesday and Friday, then the same three repeated the following week?
    • an open-ended list that does not repeat?
    • something else?
    Regards,
    Barry

  • When moving a page from one pdf to another I see a message "consolidating fonts" and the added page does not view properly

    I am working with multiple PDF files in Acrobat Pro XI.  Sometimes when I move a page from one PDF to another it does not view properly.  It was fine in the source PDF, but not when moved to the desired PDF.  I also see a message momentarily across the bottom of my screen that says "consolidating fonts".  What must I do to fix this?

    Lloyd ,
    Follow these steps for Acrobat 11 .
    Launch Acrobat>Tools>Print Production>Acrobat Distiller
    Now in Acrobat Distiller follow these.
    Select Standard in Default settings. 
    Go to Settings and select Edit Adobe PDF Settings. 
    Select Fonts and in the font source window select the fonts you want to Add. 
    Click Save As and then OK.
    See if this helps.
    Regards
    Sukrit Dhingra

  • Move node and its silings from one jtree to another

    Hi,
    I am trying to move JTree nodes and its siblings from one JTree to another. If anyone has the code, please post it on the website or mail to [email protected]
    Thanks
    Pavan

    Pavan,
    You may have to do a sanity check before adding it.
    Better run the program in a debugger and have a break point at the clipBoard.put() line. Else system.out.println() lines will kill enormouse programming time rather than using debugger.
    Also in following this thread, i found that you may have to be bit more thorough with the DefaultMutableTreeNode class first.
    Thanks,
    ananth
    Thomas,
    for (int p = 0; p < jtree.getSelectionCount(); p++) {
                   System.out.println(".3.......p= "+p);
    node =
    =
    (EuamDefaultMutableTreeNode)paths[p].getLastPathCompon
    nt();
                        clipBoard.put(node.toString(), node);
                   System.out.println(".4...........");
    Giving error at clipBoard.put()
    line....java.lang.NullPointerException
    ..Any idea why?
    Thanks.
    Pavan

  • How do I copy the style from one control to another?

    I need to programmatically copy the style from one graph to another. I'm currently using the importstyle and export style functions but I'd like to avoid that since: 1) I'm creating >100 of the same graphs in a scrolling window and execution time is a concern, and 2) it makes it harder to redistribute the application, and 3) you shouldn't have to import/export from disk just to copy a graph style.
    I noticed the copy constructor was disabled so you can't just create a new one from the original. I suppose I could iterate through all the styles and transfer them from the master graph to all the copies but is there an easier way to do that? If not, is there some sample code for that?
    I'm using MStudio 7.0 for C
    ++.
    Thanks,
    -Bob

    One way that you could do this would be to create a helper method that configures your graph rather than configuring it at design-time, then use that helper method to apply the settings to the new graphs that you create. However, this would only work if you wanted all graphs to be configured exactly the same way - this would not work if the settings of your master graph are changing at run-time and you want the new graphs to be configured with the current settings of the master graph.
    Another approach is to query each control for IPersistPropertyBag, create an IPropertyBag, pass the IPropertyBag to the master graph's IPersistPropertyBag:ave, then pass the IPropertyBag to the new graph's IPersistPropertyBag::Load implementation. I'm not aware of any implementations of IPropertyBag that are readily available for use in applications, so the tricky part is creating the IPropertyBag. Below is a very simple implementation of IPropertyBag that should be enough to get the job done for this example. First, add this to your stdafx.h:
    #include <atlbase.h>
    CComModule _Module;
    #include <atlcom.h>
    #include <atlcoll.h>
    Here's the simple IPropertyBag implementation:
    class ATL_NO_VTABLE CSimplePropertyBag :
    public CComObjectRootEx<CComSingleThreadModel>,
    public IPropertyBag
    private:
    CAtlMap<CComBSTR, CComVariant> m_propertyMap;
    public:
    BEGIN_COM_MAP(CSimplePropertyBag)
    COM_INTERFACE_ENTRY(IPropertyBag)
    END_COM_MAP()
    STDMETHODIMP Read(LPCOLESTR pszPropName, VARIANT* pVar, IErrorLog* pErrorLog)
    HRESULT hr = E_FAIL;
    if ((pszPropName == NULL) || (pVar == NULL))
    hr = E_POINTER;
    else
    if (SUCCEEDED(::VariantClear(pVar)))
    CComBSTR key = pszPropName;
    CComVariant value;
    if (!m_propertyMap.Lookup(key, value))
    hr = E_INVALIDARG;
    else
    if (SUCCEEDED(::VariantCopy(pVar, &value)))
    hr = S_OK;
    return hr;
    STDMETHODIMP Write(LPCOLESTR pszPropName, VARIANT* pVar)
    HRESULT hr = E_FAIL;
    if ((pszPropName == NULL) || (pVar == NULL))
    hr = E_POINTER;
    else
    m_propertyMap.SetAt(pszPropName, *pVar);
    hr = S_OK;
    return hr;
    Once you have a way to create an implementation of IPropertyBag, you can use IPropertyBag and IPersistPropertyBag to copy the settings from one control to another like this:
    void CopyGraphStyle(CNiGraph& source, CNiGraph& target)
    LPUNKNOWN pSourceUnknown = source.GetControlUnknown();
    LPUNKNOWN pTargetUnknown = target.GetControlUnknown();
    if ((pSourceUnknown != NULL) && (pTargetUnknown != NULL))
    CComQIPtr<IPersistPropertyBag> pSourcePersist(pSourceUnknown);
    CComQIPtr<IPersistPropertyBag> pTargetPersist(pTargetUnknown);
    if ((pSourcePersist != NULL) && (pTargetPersist != NULL))
    CComObject<CSimplePropertyBag>* pPropertyBag = 0;
    CComObject<CSimplePropertyBag>::CreateInstance(&pPropertyBag);
    if (pPropertyBag != NULL)
    CComQIPtr<IPropertyBag> spPropertyBag(pPropertyBag);
    if (spPropertyBag != NULL)
    if (SUCCEEDED(pSourcePersist->Save(spPropertyBag, FALSE, TRUE)))
    pTargetPersist->Load(spPropertyBag, NULL);
    (Note that "CreateInstan ce" above should be CreateInstance - a space gets added for some unknown reason after I click Submit.)
    Then you can use this CopyGraphStyle method to copy the settings of the master graph to the new graph. Hope this helps.
    - Elton

  • ICal move events from one calendar to another with AppleScript

    I made an AppleScript to clean up my calendars and thought I would share. My iMac had a calendar called "Home" and my iPhone had a default calendar "Calendar" so I ended up with all of my events spread across two calendars. Decide to clean up and move everything to one calendar.
    This script is admittedly not very efficient. The nested repeat loops means it takes a while to run. Feel free to take this as a start point. I have it checking each property for missing value before adding it to avoid errors. I could have added a line to delete the old event after creating the copy, but I was just deleting the whole old calendar after the script ran.
    I hope this is helpful to someone. Oh, this was created under Snow Leopard so if you are in Lion you might need to tweak things. I don't know how much the scripting library has changed.
    tell application "iCal"
              set thisCalOld to calendar "OldCalendarName"
              set thisCalNew to calendar "NewCalendarToMoveEventsTo"
              set cntrMatch to 0
              set cntrCopied to 0
              repeat with thisEventOld in events of thisCalOld
                        repeat with thisEventNew in events of thisCalNew
                                  set isOKtoProceedWithCopy to true
                                  if (start date of thisEventNew = start date of thisEventOld) and (summary of thisEventNew = summary of thisEventOld) then
                  --Don't copy
                                            set cntrMatch to cntrMatch + 1
                                            set isOKtoProceedWithCopy to false
                                            exit repeat
                                  end if
                        end repeat
                        if isOKtoProceedWithCopy then
                                  set theStamp to stamp date of thisEventOld
                                  set theAllDay to allday event of thisEventOld
                                  set theURL to url of thisEventOld
                                  set theRecur to recurrence of thisEventOld
                                  set theEndDt to end date of thisEventOld
                                  set theClass to class of thisEventOld
                                  set theStartDt to start date of thisEventOld
                                  set theDesc to description of thisEventOld
                                  set theSummary to summary of thisEventOld
                                  set theLoc to location of thisEventOld
                                  set theExcludeDt to excluded dates of thisEventOld
                                  set theSeq to sequence of thisEventOld
                                  set theStatus to status of thisEventOld
                                  tell thisCalNew
                                            set thePropList to {}
                                            if theStamp is not equal to missing value then
                                                      set thePropList to thePropList & {stamp date:theStamp}
                                            end if
                                            if theAllDay is not equal to missing value then
                                                      set thePropList to thePropList & {allday event:theAllDay}
                                            end if
                                            if theURL is not equal to missing value then
                                                      set thePropList to thePropList & {url:theURL}
                                            end if
                                            if theRecur is not equal to missing value then
                                                      set thePropList to thePropList & {recurrence:theRecur}
                                            end if
                                            if theEndDt is not equal to missing value then
                                                      set thePropList to thePropList & {end date:theEndDt}
                                            end if
                                            if theClass is not equal to missing value then
                                                      set thePropList to thePropList & {class:theClass}
                                            end if
                                            if theStartDt is not equal to missing value then
                                                      set thePropList to thePropList & {start date:theStartDt}
                                            end if
                                            if theDesc is not equal to missing value then
                                                      set thePropList to thePropList & {description:theDesc}
                                            end if
                                            if theSummary is not equal to missing value then
                                                      set thePropList to thePropList & {summary:theSummary}
                                            end if
                                            if theLoc is not equal to missing value then
                                                      set thePropList to thePropList & {location:theLoc}
                                            end if
                                            if theExcludeDt is not equal to missing value then
                                                      set thePropList to thePropList & {excluded dates:theExcludeDt}
                                            end if
                                            if theSeq is not equal to missing value then
                                                      set thePropList to thePropList & {sequence:theSeq}
                                            end if
                                            if theStatus is not equal to missing value then
                                                      set thePropList to thePropList & {status:theStatus}
                                            end if
                                            set theNewCopy to make new event at end with properties thePropList
                                  end tell
                                  set cntrCopied to cntrCopied + 1
                        end if
              end repeat
    end tell
    display dialog ("Exists(not copied):" & cntrMatch & "  New Copied:" & cntrCopied)

    That should not be necessary because I get the value of ID out of another table, where I generate ID with a sequence..
    So normally it should just tranfer that row from one table to another. But it doesn't !
    Knowing that I cannot create a row in the table wouter_published_posts(I can just move rows from the add_post table to the wouter_published_posts table), It should be inpossible that twice the ID appears. But yet he keeps trowing errors...
    help me, please

Maybe you are looking for

  • How can I finish the last step in the 2 Day Plus Appl Express Developer

    Hi, I try to follow doing the steps the Chapter 8 How to Upload and Download Files in an Application of the 2 Day Plus Application Express Developer, after I had finished the input to Oracel XE (all steps in this chapter and the procedure in 'Downloa

  • SCCM 2012 - Reporting Services - No Reports show up in Console!

    Hi, I’m in the process of building our new 2012 SCCM infrastructure and have hit a small issue. When installing the Reporting services Point it appears to run through ok however no reports are populated. So far I’ve checked the: srsrpMSI.log - No Err

  • Need to include the R/3 Business system in SLD.

    Now i need to include the R/3 Business system in SLD. To do that i have to establish an RFC connection, could anyone guid me what type of RFC connection i need to use like HTTP connection or else other..... Get me the details.

  • Adobe AIR desktop app with an embedded runtime

    Hi, Does an Adobe AIR desktop app with an embedded runtime (standalone/portable)  that got published on Windows work on a Mac too? Thanks

  • Split dates in SAP Query

    Dear experts, While using  a query over a specific period in which a person has multiple periods they are displayed as mulitple lines. In the output I want to include the validity period of this line. SAP uses during runtime the fields: SYHR_splits_w