How to display result in the same portlet

Hi,
I've a dynamic page with some links in there. I want to display the results of the links in the same portlet. Can anyone please let me know how can I achieve this?
Thanks in advance.
Regards,
Jatinder

You can check in portalstudio.
Pls see Re: probem with databse connection using OCI driver

Similar Messages

  • How to display data with the same text and key in the drop down list?

    Hi All,
    Would like so to seek for you advice on the above mention topic. How to display the data with the same text and key using function module 'VRM_SET_VALUES'. From my testing by writing a program, this function module will only show the text and key if both have different data. Please find the coding as below. Is the normal behaviour of this function module? How to overcome this problem? Thanks in advance.
    REPORT ZTESTING.
    TYPE-POOLS: VRM.
    DATA: NAME  TYPE VRM_ID,
          LIST  TYPE VRM_VALUES,
          VALUE LIKE LINE OF LIST,
          c(20) type c.
    *      c = 'select any'.
    data:begin of itab occurs 0,
          kunnr like kna1-kunnr,
          name1 like kna1-name1,
         end of itab.
    data:begin of jtab occurs 0,
          kunnr like kna1-kunnr,
          land1 like kna1-land1,
         end of jtab.
    PARAMETERS: p_list(20) AS LISTBOX VISIBLE LENGTH 20
                              default 'SELECT'.
    AT SELECTION-SCREEN OUTPUT.
    NAME = 'p_list'.
    VALUE-KEY = 'Name'.     "---> Data for key is the same with text
    VALUE-TEXT = 'Name'.    "--> Data for text is the same with key
    APPEND VALUE TO LIST.
    VALUE-KEY = '2'.
    VALUE-TEXT = 'Country'.
    APPEND VALUE TO LIST.
    CALL FUNCTION 'VRM_SET_VALUES' EXPORTING ID = NAME VALUES = LIST.
    start-of-selection.
    select kunnr name1 up to 20 rows from kna1 into table itab.
    select kunnr land1 up to 20 rows from kna1 into table jtab.
    case p_list.
    when '1'.
    loop at itab.
    write:/ itab-kunnr,itab-name1.
    endloop.
    when '2'.
    loop at jtab.
    write:/ jtab-kunnr,jtab-land1.
    endloop.
    endcase.
    <Added code tags>
    Moderator Message: Please use the "code" tags to format your code snippet.
    Edited by: Suhas Saha on Nov 17, 2011 11:19 AM

    shawnTan wrote:
    Hi All,
    >
    > Would like so to seek for you advice on the above mention topic. How to display the data with the same text and key using function module 'VRM_SET_VALUES'. From my testing by writing a program, this function module will only show the text and key if both have different data. Please find the coding as below. Is the normal behaviour of this function module? How to overcome this problem? Thanks in advance.
    >
    >
    REPORT ZTESTING.
    >
    > TYPE-POOLS: VRM.
    >
    > DATA: NAME  TYPE VRM_ID,
    >       LIST  TYPE VRM_VALUES,
    >       VALUE LIKE LINE OF LIST,
    >       c(20) type c.
    >
    > *      c = 'select any'.
    >
    > data:begin of itab occurs 0,
    >       kunnr like kna1-kunnr,
    >       name1 like kna1-name1,
    >      end of itab.
    >
    > data:begin of jtab occurs 0,
    >       kunnr like kna1-kunnr,
    >       land1 like kna1-land1,
    >      end of jtab.
    >
    > PARAMETERS: p_list(20) AS LISTBOX VISIBLE LENGTH 20
    >                           default 'SELECT'.
    >
    > AT SELECTION-SCREEN OUTPUT.
    >
    > NAME = 'p_list'.
    >
    > VALUE-KEY = 'Name'.     "---> Data for key is the same with text
    > VALUE-TEXT = 'Name'.    "--> Data for text is the same with key
    > APPEND VALUE TO LIST.
    >
    > VALUE-KEY = '2'.
    > VALUE-TEXT = 'Country'.
    > APPEND VALUE TO LIST.
    >
    > CALL FUNCTION 'VRM_SET_VALUES' EXPORTING ID = NAME VALUES = LIST.
    >
    > start-of-selection.
    > select kunnr name1 up to 20 rows from kna1 into table itab.
    > select kunnr land1 up to 20 rows from kna1 into table jtab.
    >
    > case p_list.
    > when '1'.
    > loop at itab.
    > write:/ itab-kunnr,itab-name1.
    > endloop.
    >
    > when '2'.
    > loop at jtab.
    > write:/ jtab-kunnr,jtab-land1.
    > endloop.
    > endcase.
    >
    > <Added code tags>
    >
    > Moderator Message: Please use the "code" tags to format your code snippet.
    >
    > Edited by: Suhas Saha on Nov 17, 2011 11:19 AM
    This surely seems to be a bug to me(if not by design),  did you check for any SAP notes? Perhaps a front end trace can help(Note 407743) !
    -Rajesh.

  • How to display data in the same tab components ?

    Hi,
    I have a tabbed pane and contains 3 tabs. I have entered some value in the text field and clicked the enter button in the 3rd tab.This enter button contains some validation code and after validation it will display some data in the text area in the same tab. In the mean time , i am navigating to another tab eg first tab. But my data is displayed in the second tab instead of 3rd tab.
    can anyone help me to solve this ?
    bye for now
    sat

    But my data is displayed in the second tab instead of 3rd tab.
    can anyone help me to solve this ?Then you are updating the component on the second tab. Fix your code.

  • How to display data in the same row

    Hi i have a data like this
    sales_order_no shipped_amount aggregate_source_order_num
    1 10000 sao/1
    1 10000 sao/2
    2 10000 sao/4
    2 10000 sao/5
    2 10000 sao/6
    now i want to disply like this:
    sales_order_no shipped_amount aggregate_source_order_num
    1 10000 sao/1,sao/2
    2 10000 sao/4,sao/5,sao/6
    can anybody help me how to do it??
    i really appreciate your help.

    or
    SQL> set linesize 120;
    SQL> with sales_order as
      2   (select 1 sales_order_no, 10000 shipped_amount, 'sao/1' aggregate_source_order_num from dual union all
      3    select 1 sales_order_no, 10000 shipped_amount, 'sao/2' aggregate_source_order_num from dual union all
      4    select 2 sales_order_no, 10000 shipped_amount, 'sao/4' aggregate_source_order_num from dual union all
      5    select 2 sales_order_no, 10000 shipped_amount, 'sao/5' aggregate_source_order_num from dual union all
      6    select 2 sales_order_no, 10000 shipped_amount, 'sao/6' aggregate_source_order_num from dual)
      7  select so.sales_order_no,
      8         so.shipped_amount,
      9         substr(max(substr(sys_connect_by_path(so.aggregate_source_order_num,','),2)),1,60) aggregate_source_order_num
    10    from (select sales_order_no,
    11                 shipped_amount,
    12                 aggregate_source_order_num,
    13                 row_number() over (partition by sales_order_no, shipped_amount
    14                                    order by sales_order_no, shipped_amount) rn
    15            from sales_order) so
    16  start with so.rn = 1
    17  connect by so.rn = prior so.rn + 1
    18  and prior so.sales_order_no = so.sales_order_no
    19  group by so.sales_order_no,
    20           so.shipped_amount;
    SALES_ORDER_NO SHIPPED_AMOUNT AGGREGATE_SOURCE_ORDER_NUM
                 1          10000 sao/1,sao/2
                 2          10000 sao/4,sao/5,sao/6
    SQL>

  • Display search results on the same page

    I have a text box with a submit button to the left. Once the user enter the a number in the search field my select query executes.
    My question is how can i display the reult on the same page? I have been able to display results on the same page but my table headers are also displayed at the same time while user is trying to enter the item number.
    i tried using <c:if> but its not wokring, Any help?
    <%@ include file="/WEB-INF/jsp/include.jsp" %>
    <html>
    <head>
    <title>VDP QOH UPDATE</title>
    </head>
    <body>
    <spring:bind path="quantityOnHand">
      <FONT color="red">
        <B><c:out value="${status.errorMessage}"/></B>
      </FONT>
    </spring:bind>
    <P>
    <FORM name="quantityOnHandForm" method="POST" action = ''>
    <CENTER>
    <table BORDER=0  CELLSPACING=0 CELLPADDING=5 WIDTH=600>
        <tr>
              <td COLSPAN=2 BGCOLOR="#003366"><P ALIGN=CENTER><B><FONT COLOR="#FFFFFF" SIZE="2" FACE="Arial,Helvetica,Univers,Zurich BT">Query</FONT></B>
              </td>
         </tr>
         <tr>
              <td WIDTH=215 BGCOLOR="#336699"><P ALIGN=RIGHT>
                  <B>
                     <FONT COLOR="#FFFFFF" SIZE="-1" FACE="Arial,Helvetica,Univers,Zurich BT">
                        Item No:
                      </FONT>
                   </B>
              </td>
              <td ALIGN=LEFT><spring:bind path="quantityOnHand.itemNumber">
                      <input type="text" maxlength="30" size="10" name='<c:out value="${status.expression}"/>' value='<c:out value="${status.
                             value}"/>'>
        <td><font color="red"><c:out value="${status.errorMessage}" /></font>    </td>
           </spring:bind>
              </td>
         </tr>
        <tr>
            <td BGCOLOR="#336699" WIDTH=215> </td>
            <td>
                <input type="submit" name="Submit" value="Submit" >
           </td>
       </tr>
    </table>
    </center>
    </form>This is basically all of my search jsp code. Now i've added my other code after </form> to display the results.
    </form>
    <table BORDER=0  CELLSPACING=0 CELLPADDING=5 WIDTH=600>
        <tr>
              <td COLSPAN=2 BGCOLOR="#003366"><P ALIGN=CENTER><B><FONT COLOR="#FFFFFF" SIZE="2" FACE="Arial,Helvetica,Univers,Zurich BT">Quantity On Hand Search Results</FONT></B>
              </td>
         </tr>
         </table>              
    <c:choose>
    <c:when test="${empty qohInfo}">
             <div align="left" style="color:#336699;"><b>No records Found.<br><br></b></div>
    </c:when>
    <c:otherwise>
         <table width="602" height="92">
              <tr>   
                   <th ALIGN=CENTER BGCOLOR="#336699" width="110" >
                       <B>
                          <FONT COLOR="#FFFFFF" SIZE="-1" FACE="Arial,Helvetica,Univers,Zurich BT">Item Number</FONT>
                       </B>
                   </th>
                   <th ALIGN=CENTER BGCOLOR="#336699" width="115">
                       <B>
                          <FONT COLOR="#FFFFFF" SIZE="-1" FACE="Arial,Helvetica,Univers,Zurich BT">Vendor Id </FONT>
                       </B>
                   </th>
                   <th ALIGN=CENTER BGCOLOR="#336699" width="120">
                       <B>
                          <FONT COLOR="#FFFFFF" SIZE="-1" FACE="Arial,Helvetica,Univers,Zurich BT"> Inventory Date</FONT>
                       </B>
                   </th>
                   <th ALIGN=CENTER BGCOLOR="#336699" width="130" >
                       <B>
                          <FONT COLOR="#FFFFFF" SIZE="-1" FACE="Arial,Helvetica,Univers,Zurich BT">Update Date Time </FONT>
                       </B>
                   </th>
                   <th ALIGN=CENTER BGCOLOR="#336699" width="100" >
                       <B>
                          <FONT COLOR="#FFFFFF" SIZE="-1" FACE="Arial,Helvetica,Univers,Zurich BT">Quantity</FONT>
                       </B>
                   </th>
              </tr>
              <c:forEach var="qohInfo" items="${qohInfo}" varStatus="loop">
        <tr BGCOLOR="#99CCFF">
          <TD align="center"><c:out value="${qohInfo.itemNumber}"/></TD>
          <TD align="center"><c:out value="${qohInfo.vendorId}"/></TD>
          <TD align="center"><c:out value="${qohInfo.inventoryDate}"/></TD>
          <TD align="center"><c:out value="${qohInfo.updateDateTime}"/></TD>
          <TD align="center"><c:out value="${qohInfo.quantity}"/></TD>
        </TR>
      </c:forEach>
      </table>
      </c:otherwise>
      </c:choose>As you can see that the table headers are always shown but i would like to hide the table headers and everything until and unles user clicks on submit button. Any help is appreciated.

    Thanks balusc for your reply. I was curious how would you have used the c:if statement to display the table and hide the table if a user have not clicked the button.
    I wanted to stay away from javasscript

  • Firefox doesn't show/display my addressbook within my hotmail account anymore. Cookies/Cashe has been emptied already, result is the same.

    Firefox doesn't show/display/load my addressbook within my hotmail account anymore, it worked previously well, so has nothing to do with the change from hotmail to outlook. Since a week or so, I realized a slowness in loading my recently used addresses with opening a new e-mail, but it was still working from time to time. For a few days, it has been stopped working, complete addressbook doesn't load anymore, just displays the load circle in the middle of the screen, apart from that I have only a white page. Cache and Cookies already emptied/deleted, result is the same. No settings have been changed, but have the same issue with Internet Explorer, but it's working with Chrome. For testing, I deactivated my firewall and anti virus (Comodo), but the result was still the same. I would appreciate if I could get it working again here. Every suggestion is welcome here

    Boot the computer in Windows Safe Mode with network support (press F8 on the boot screen) as a test to see if that helps.
    Create a new profile as a test to check if your current profile is causing the problems.
    See "Creating a profile":
    *https://support.mozilla.org/kb/profile-manager-create-and-remove-firefox-profiles
    *http://kb.mozillazine.org/Standard_diagnostic_-_Firefox#Profile_issues
    If the new profile works then you can transfer some files from an existing profile to the new profile, but be careful not to copy corrupted files.
    *http://kb.mozillazine.org/Transferring_data_to_a_new_profile_-_Firefox
    Do a malware check with some malware scanning programs on the Windows computer.<br />
    Please scan with all programs because each program detects different malware.
    Make sure that you update each program to get the latest version of their databases before doing a scan.
    *Malwarebytes' Anti-Malware:<br>http://www.malwarebytes.org/mbam.php
    *SuperAntispyware:<br>http://www.superantispyware.com/
    *Microsoft Safety Scanner:<br>http://www.microsoft.com/security/scanner/en-us/default.aspx
    *Windows Defender: Home Page:<br>http://www.microsoft.com/windows/products/winfamily/defender/default.mspx
    *Spybot Search & Destroy:<br>http://www.safer-networking.org/en/index.html
    *Kasperky Free Security Scan:<br>http://www.kaspersky.com/security-scan
    You can also do a check for a rootkit infection with TDSSKiller.
    *http://support.kaspersky.com/viruses/solutions?qid=208280684
    See also:
    *"Spyware on Windows": http://kb.mozillazine.org/Popups_not_blocked

  • I have problem with my wifi in 4 S, i cant connect to any wifi itried resetting network setting and reset all setting but the result was the same, its only keeps searching for wifi and cant find any, itried to use OTHER but also didnt work.please help me

    i have problem with my wifi in 4 S, i cant connect to any wifi itried resetting network setting and reset all setting but the result was the same, its only keeps searching for wifi and cant find any, itried to use OTHER but also didnt work.please help me???

    If Join was on then your home wi-fi must be set to Non-Broadcast.  If you did not set this up (maybe your provider did) then you will need to find the Network Name they used, and any password they used.  The SSID is Security Set ID and to see more try http://en.wikipedia.org/wiki/SSID .  Basically it is the name used to identify your router/network.  A lot of times the installer will leave it set as LinkSys, or Broadcom or whatever the manufacturer set it as for default.  Your best bet is to get whoever installed it to walk you through how they set it up, giving you id's and passwords so you can get in.  HOWEVER, if you are not comfortable with this (if you set security wrong, etc.) you would be well ahead of the game to hire a local computer tech (networking) to get this working for you.  You can also contact the vendor of your router and get help (if it is still in warranty), or at least get copies of the manuals as pdf files.  Sorry I can't give you more help, I hope this gives you an idea where to go from here to find more.

  • Distinguishing between two instances of the same portlet

    Hi Experts,
    Is there a way to distinguish between two instance of the same portlet in different browser windows?
    I'm looking for something like URL parameter passing, but just for portlets.
    The problem is, I want a way to pass a parameter between views in a portlet, but in such a way that if another browser window is opened and navigated to that portlet page, the parameter won't be the same. Perhaps I can explain better with this example:
    Page A has a portlet on it which has a textbox and 2 buttons - the first button stores the value in the textbox in the PortletRequest (or PortletURL) and if you click the second button the portlet navigates to a different view which displays the value. If I navigate with a second browser window to Page A, however, and only click the navigate button, that value which was stored by the first instance of the portlet will still be shown. I want them to be independent, I don't want changes in the one's PortletRequest to reflect in the other one's PortletRequest.
    Any ideas?
    Thanks,
    JP

    Why not use two instances of the same portlet, i.e. create two channels of the same portlet.
    The behave the same, have the same application logic, so all you need is to transfer informations between the two portlets.If you want this within user space use the portlet session, otherwise access the http session context /application context and store the data there.
    The behavior would be controlled by the portlet preferences, so channel a (instance 1) would be configured to run as controller and channel b (instance 2) would be configured as receiver.

  • How come two signals of the same frequency show on the graph as having the same?

    Hi!
    My assignment for school is to build a 2 channel oscilloscope, with generators too. Initially, I tried using a waveform chart, that actually showed a very "ugly" image. Just for testing, I left the chart there with hidden indicator.
    The student teacher suggested I use a graph, which is ok, as far as the shape of the signal. The "time" axis however doesn't really show the time.
    Thinking that it might show the samples, I put at the "nr.of samples" the reciprocal of the sampling rate multiplied with 1000,000 and the result was the same. The really strange part is that if I'd put two different frequencies for each channel it showed as is the signals had the same frequency.
    And that's not the only problem... The while loop everything is in doesn't look like it's executing more than once. Now, I know the vi is pretty large but is that what makes it behave like that?
    I also put cursors (like in the example from Fundamentals> Graphs and Charts > Programatically Control Cursors) that should be in the middle of the graph. Since I didn't use a chart, are the values at "Style" or "Pointer Style" different? (I wanted the cursors to be multi-plot).
    Can you help me with any of that?
    Thank you very much!
    Patricia

    Hi Patricia !
    First of all, I would suggest you to synchronize all actions according to data flow concept : try to link all property nodes with error wires... That way, you MAY notice some warnings/errors. Then you should try to group functionalities into clusters, that way your code would be easier to debug...
    Then your While Loop runs as fast as possible (which makes your processor to run at 100% all time long), you should consider using a timing function to slow down the loop.
    Then using "Graphs", the X-axis will display the number of samples in the array to plot. If you know the sampling frequency of your signal and the number of samples in the array, you can try use "Xaxis.Multiplier" property node to convert the number of samples into time.
    Then for your cursors, you should consider using "Cursos List" property node... It's not really cool to program it (lot of options) but it works very well and allows you to deeply customize your cursors.
    I hope this helps... Otherwise, don't hesitate to post another message !
    Zyl

  • How to Print File as the same as picture/fax viewer ?

    Hallo :
    I wrote a program which can let the specified png file to be printed. (png file is about 17xx * 11xx, output to A4 paper)
    The goal is the print result as the same as the windows built-in picture/fax viewer (by Full Page Fax Print Mode)
    And I don't want the printer dialog to be appeared. So I tried to use java print service to achieve this goal.
    Now I can print the file by printer.
    But comparing to the result which is printed by the windows built-in picture fax viewer(use Full Page Fax Print Mode), my result looks like zoom in, not full page.
    I tried some classes of javax.print.attribute.standard package, but no one worked.
    So I tried to transform the image by myself. And I found a resource : [http://java.sun.com/products/java-media/2D/reference/faqs/index.html#Q_How_do_I_scale_an_image_to_fit]
    It looks like what I wanted. But when I implemented the functionality according to that reference. The result is still the same, still zoom in...
    I must said I am unfamiliar with java 2D. But this is a problem I must solve.
    If the problem can be solved by only setting some classes of javax.print.attribute.standard, it's better.
    But if can't be solved by that way, the transformation method is ok, too.
    So does anyone can help me to solve this problem or pointed where I was wrong ? Thank you very much.
    import java.io.*;
    import java.net.*;
    import java.text.DecimalFormat;
    import java.awt.*;
    import java.awt.geom.*;
    import java.awt.image.ImageObserver;
    import java.awt.print.*;
    import javax.print.*;
    import javax.print.attribute.*;
    import javax.print.attribute.standard.*;
    public class TestImage{
       private void testPrint2() {
         Image img = Toolkit.getDefaultToolkit().getImage(A); // A is png file path
         PrintRequestAttributeSet requestAttributeSet = new HashPrintRequestAttributeSet();
         requestAttributeSet.add(new Copies(1));
         requestAttributeSet.add(MediaSizeName.ISO_A4);
         requestAttributeSet.add(OrientationRequested.PORTRAIT);
         requestAttributeSet.add(MediaTray.MANUAL);
         PrintService[] services = PrintServiceLookup.lookupPrintServices(null, requestAttributeSet);
         if(services.length > 0){
              DocPrintJob job = services[0].createPrintJob();
              try {
                   job.print(new SimpleDoc(new TestPrint(img), DocFlavor.SERVICE_FORMATTED.PRINTABLE , null), requestAttributeSet);
              } catch (PrintException pe) {
                 pe.getStackTrace();
       class TestPrint implements Printable {
         private Image image;
         public TestPrint(Image image) {
              this.image = image;
         public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException {
              if(pageIndex > 0) {
                  return Printable.NO_SUCH_PAGE;
              Graphics2D g2d = (Graphics2D) graphics;
              //Set us to the upper left corner
              g2d.translate(pageFormat.getImageableX(), pageFormat.getImageableY());
              AffineTransform at = new AffineTransform();
              g2d.translate(0, 0);               
              //We need to scale the image properly so that it fits on one page.
              double xScale = pageFormat.getImageableWidth() / image.getWidth(null);
              double yScale = pageFormat.getImageableHeight() / image.getHeight(null);
              // Maintain the aspect ratio by taking the min of those 2 factors and using it to scale both dimensions.
              double aspectScale = Math.min(xScale, yScale);
              //g2d.drawRenderedImage(image, at);
              g2d.drawImage(image, at, (ImageObserver) this);
              return Printable.PAGE_EXISTS;               
       public static void main(String[] args) {
         new TestImage().testPrint2();
    }Edited by: oppstp on Aug 3, 2010 10:14 AM
    Edited by: oppstp on Aug 3, 2010 10:18 AM

    Thanks for the reply.
    Now my algorithm which I used is when the height of image is smaller than the height of A4 paper and the width of image
    is larger than the width of A4 paper, I will rotate 90 degree of the image first, then I will scale the image.
    Then I can get the approaching result when the width and height of the image are larger than the width and height of A4 paper.
    But there was an additional error. That is when the width of image is larger than the width of A4 paper and
    the height of image is smaller than the height of A4 paper. (like 17xx * 2xx).
    Although the print result template is approaching the picture/fax viewer. But the print quality is so bad.
    The texts are discontinue. I can see the white blank within the text. (the white line are the zone which printer doesn't print)
    First I thought this problem might be DPI issue. But I don't know how to keep the DPI when rotating ?
    (I dumped the rotate image, it rotates, but didn't keep the DPI value)
    Does anyone know how to solve this strange problem ? Thanks a lot.
    Below is my test code (the initial value of transX & transY and 875 are my experiment result)
    import java.io.*;
    import java.awt.*;
    import java.awt.geom.*;
    import java.awt.image.*;
    import java.awt.print.*;
    import javax.imageio.*;
    import javax.print.*;
    import javax.print.attribute.*;
    import javax.print.attribute.standard.*;
    public class TestCol{ 
       private void testPrint2() throws Exception {
          BufferedImage bSrc = ImageIO.read(new File(A)); // A is png file path
          PrintRequestAttributeSet requestAttributeSet = new HashPrintRequestAttributeSet();
          requestAttributeSet.add(new Copies(1));
          requestAttributeSet.add(MediaSizeName.ISO_A4);
          requestAttributeSet.add(OrientationRequested.PORTRAIT);
          PrintService[] services = PrintServiceLookup.lookupPrintServices(null, requestAttributeSet);
          if (services.length > 0) {
             DocPrintJob job = services[0].createPrintJob();
             try {
                job.print(new SimpleDoc(new TestPrint(bSrc), DocFlavor.SERVICE_FORMATTED.PRINTABLE , null), requestAttributeSet);
             } catch (PrintException pe) {
                pe.getStackTrace();
       class TestPrint implements Printable {
          private BufferedImage image;
          public TestPrint(BufferedImage image) {
             this.image = image;
          public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException {
             if(pageIndex > 0) {
                return Printable.NO_SUCH_PAGE;
             int transX = 10;
             int transY = 35;
             int imgWidth = image.getWidth();
             int imgHeight = image.getHeight();
             Graphics2D g2d = (Graphics2D) graphics;
             //Set us to the upper left corner
             AffineTransform at = new AffineTransform();
             double xScale = 0.0;
             double yScale = 0.0;
             if((double)imgWidth > pageFormat.getImageableWidth()) {
                if(imgHeight > 785) {         
                   // X:image larger, Y:image larger -> scale all > 1, no rotate
                   xScale = pageFormat.getImageableWidth() / imgWidth;
                   yScale = (double)785 / imgHeight;
                } else {       
                   // X:image larger, Y:image smaller -> rotate right 90 degree than scale X
                   // rotate right 90 degree
                   at.translate(imgHeight/2.0, imgWidth/2.0);
                   at.rotate(Math.toRadians(90.0));
                   at.translate(-0.5*imgWidth, -0.5*imgHeight);
                   //at.preConcatenate(g2d.getTransform()); // if add this line, the result is zoom out many times, and the result is  not one page
                   try {
                      // output rotating image for debug
                      BufferedImage bDest = new BufferedImage(imgHeight, imgWidth, BufferedImage.TYPE_INT_RGB);
                      Graphics2D g = bDest.createGraphics();
                      g.drawRenderedImage(image, at);
                      ImageIO.write(bDest, "PNG", new File(B)); // B is output png file path
                   } catch (Exception ex) {
                       ex.printStackTrace();
                   transX = (int)((pageFormat.getImageableWidth() - imgHeight)/2);         
                   xScale = 1.0;
                   yScale = (double)785 / imgWidth;
             } else {
                if(imgHeight > 785) {       
                   // X:image smaller, Y:image larger -> no rotate, scale Y
                   xScale = 1.0;
                   yScale = (double)785 / imgHeight;
                } else {         
                   // X:image smaller , Y:image smaller -> no scale, no rotate
                   xScale = 1.0;
                   yScale = 1.0;
            g2d.translate(transX, transY);
            g2d.scale(xScale, yScale);
            g2d.drawRenderedImage(image, at);
            return Printable.PAGE_EXISTS;     
       public static void main(String[] args) {
          try {
             new TestCol().testPrint2();
          } catch (Exception ex) {
             ex.printStackTrace();
    }Edited by: oppstp on Aug 4, 2010 10:46 AM

  • How to display result of database query in JFrame?

    How to display result of oracle database query in JFrame?
    This is part of my code:
    String username, password;
              DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
              OracleConnection conn = DriverManager.getConnection(String url, String username, String password);
    Statement s= conn.createStatement();
    ResultSet q= s.executeQuery("SELECT A, B, C FROM TABLE X");
    Forget what url, username & password are. Is there any problem with my code?
    What should be next if I want to display result of the query in a table in JFrame?Thx !

    How to create JTable with unknown no. of rows? How to get no. of rows of a query?
    I saw the demo of creating JTable on java.sun.com but the the table has a certain no. of rows which is not applicable to my case.
    Suppose the result of query is a table with 3 attributes so there are 3 columns in the table.
    R contains the result of the query.
    Should it be something like this if I want to create JTable of the query?
    How to make n rows of {R.getString(1),R.getString(2),R.getString(3)};?
    public SimpleTableDemo() {
    super(new GridLayout(1,0));
    String[] columnNames = {"A",
    "B",
    "C",
    while (R.next())
    // content of a row
    Object[][] data = {R.getString(1),R.getString(2),R.getString(3)};
    I can't run it because I still can't debug my code which is said before.
    Thx!

  • Opening href in the same portlet.

    Scenario:
    Portlet points to the search.aspx page which collects search parameters to perform a user search. The aspx page postback to itself and posts the response on the same portlet as list of users with their names as hrefs. When you click the hrefs the href takes you to detail.aspx.
    My problem is how to open detail.aspx in the same portlet. Is there a way in which the href can open in the same portlet?
    Any help is appreciated

    You would need to use Adaptive Portlets to do that: http://www.plumtree.com/edoc/index.asp?pagename=Customizing/Portlets/Adaptive_Portlets/Patterns/Trail_Portlets_AdaptivePortlets_Patterns.htm
    Take a look at the Inline Navigation and Inline Post examples.

  • How to display two grids in same screen using SALV Method

    Hi Freinds,
    Please let me know how to display two grids in same screen using SALV Method.
    Thank you
    Regards,
    SDV

    Using the same concept as described in How to dispaly Three Internal Table  Data (One below another) in ALV OOPS .
    All you need to add is passing your new containers as r_container parementer of factory method.
    "1st one
          cl_salv_table=>factory(
             EXPORTING
               R_CONTAINER    = g_top_container
    "2nd one
          cl_salv_table=>factory(
             EXPORTING
               R_CONTAINER    = g_bottom_container
    Regards
    Marcin

  • How can I save to the same map every time when printing pdfs?

    How can I save to the same map every time when printing pdfs?
    Finder points to the document map even when I chose a different map recently.
    I often print series of pdfs from the print dialog box, I'd like to choose the map to save to and then have all subsequent pdf prints automatically directed to the same map until I decide otherwise.

    that link seems to be broken right now:
    403 Error - Forbidden  - No cred, dude.

  • I have itunes on a mac with 2 users but the library only shows on the main user how can both users have the same library?

    i have itunes on a mac with 2 users but the library only shows on the main user how can both users have the same library?

    Hi,
    Have a Look at these Links on Home Sharing:
    http://support.apple.com/kb/HT4620
    http://support.apple.com/kb/HT3819
    Could be what you need...
    Cheers,

Maybe you are looking for

  • Does iPhoto 6 support full-featured slideshow copying between Macs finally?

    Hi, I created long slideshows with the slideshow feature of iPhoto 5. It seems that full-featured sharing and copying of that slideshow to another equal equipped Mac is not possible with iPhoto 5. Only the copying of that slideshow as a bare album se

  • Macbook DVD burn problem

    I've a Macbook Pro running Snow Leopard. I just now tried to burn a DVD following the instructions in Mac Help, and it whirred away fine for a few minutes then I got the following error message: After this message the drive whined and whirred for a c

  • JMS Bridge not Working

    Hi, I have a weblogic 9.2 running one application. I what that application to post messages on a internal JMS queue. That message gets fw to a Weblogic 8 JMS queue. To achieve this I created a JMS Bridge with the Weblogic 8 destination, and the Weblo

  • From canada - how to buy text in spanish for elementary school student in Colombia

    How can I purchase elementary school text books iin I books for a student in Colombia ( in Spanish)

  • Revenue recognition in Item category

    Dear All Can you advise what exactly is revenue recognition in item category?. I need to enter A in the field, but the field is greyed. Thanks Deepu Pillai