Methods to break pages and re-paginate

I am trying to do the following:
- Load a text document into an NSString object
- Then open the contents in NSTextView
OK, that's easy. But what I want to do now is:
1. Break the text document to pages and display each page separately in Text View.
2. When resizing the Window (and hence the Text View) I want to automatically re-paginate the text contents of the page displayed and move the remaining text into the next page (if I make the Window smaller).
In summary, I want to have multiple "logical" pages of my text document and display each page separately in Text View with the ability to re-paginate when resizing.
Is there a method already defined in Cocoa to do this automatically for me, or do I have to build by own?

BMP,
How you go about rearranging pages in a document depends to a great extent on the content. When you say you want to move a page that implies that your pages are bounded regions of content that aren't dependent on what comes before and what follows. To do this compartmentallization, you should Insert > Section Break between pages. If you have done that, you can then drag the thumbnails around in the thumbnail pane.
Only Sections can be rearranged, not pages within a Section, by dragging thumbnails.
If you have a block of text that needs to be earlier or later in a Section, just Select the block, Edit > Cut, and reposition the Text Insertion Cursor and Edit > Paste.
Unless you have intentionally inserted a section break or Inserted a Section, you have only one section in your document and therefore can't drag thumbnails.
Regards,
Jerry

Similar Messages

  • I want to break inheritence and create unique permissions in a Project Server 2010 project site list/library.

    Some Project Managers want to restrict permissions on certain lists or libraries in their Project Server 2010 project site. However, when I have done this for them, by breaking inheritence to the parent site and then removing/adding users with unique
    sharepoint permissions, it seems that when the project schedule is published, some of the newly created permissions are lost.
    I have tried creating a SharePoint group at the project site level and then applied it with specific permissions (eg. Contribute) to the list/library and this seems to work better but I haven't been able to confirm yet if this will work in the
    longer term.
    Does anyone know what is the best method to break inheritence and set up unique permissions on a list in a Project Server 2010 project site that will not be lost when the project schedule is published?
    Thanks
    Peter

    Thanks Lynda
    I am aware that I can disengage the entire permissions sychronisation using that setting but that is not what I want to do.  I just want to be able to break the inherited permissions on individual document libraries or lists on specific Project Sites
    so that I can restrict access to nominated people.
    My issue is that when I do this, I find that some of the amended permissions disappear from time to time.  It seems to be related to when the schedule is published.  They
    don't revert to the inherited permissions, just some of the people who I have given direct access to no longer have access.
    Im just trying to find out the best way to manage setting non-automated permissions on a single list or library in a Project Server project sites so the changes stick.
    Peter

  • Why does the update change my home page and make Google so prevelant?

    Several of the last "updates" involved the changing of my bookmarks and home page,. The so called update required me to spend more time in refreshing the browser to its previous condition. This is frustrating to say the least. Second why does the updated version of of firefox seem to favor google?

    Normally, an update does not change your home page...
    What did you home page change to? That might help identify the source of the problem.
    I assume you have tried changing your home page back to your preferred site, either in the Options dialog or using one of the other methods:
    * [[Startup, home page and download settings]]
    * [[How to set the home page]]
    Did that work at all? By "at all" I mean:
    * Immediately after making the change, if you click the Home button, or launch a new window using Ctrl+n, does your preferred page load? Or is that ignored?
    * Does the setting revert later in your session (you see in Options it has changed)?
    * Does the setting revert after you exit and start Firefox up again?
    * Is the problem only when you use your Firefox desktop shortcut?
    With that information, it will be easier to recommend a solution.
    I'm not sure I understand your second question. Google has always been the default search provider in Firefox. Are you seeing even more Google than that?

  • I had created my apple id from apple's site and now when i am trying to sign in to itunes ,i m being taken to payment method page and there is no option as 'none' and i dont have a credit card.What to do?

    i had created my apple id from apple's site and now when i am trying to sign in to itunes ,i m being taken to payment method page and there is no option as 'none' and i dont have a credit card.What to do?

    Unless you use the steps on this page when creating a new account : http://support.apple.com/kb/HT2534
    then you will need to enter credit card details before the account can be used to download any item from the store.
    If you don't have a credit card then you will need to create a new account, and follow those instructions. If you want to use the same email address then you will need to remove it from that account first e.g.by logging into it via the Store > View Account menu option on your computer's iTunes or via http://appleid.apple.com - you should then be able to use it on a new account.
    Steps for creating an account on a computer's iTunes : https://discussions.apple.com/message/24321860#24321860

  • JSP page and the pageContext.forward() method

    I am running JSP pages on a coldfusion site so that a CF page (i.e. login.cfm) hosts my login.jsp page. I want to reload the JSP page without having to reload the cfm page each time. pageContext.forward() does do this, however, it only forwards on to a new page. I want to be able to reload a page with the new URL parameters (e.g. when there is an error, login.jsp will reload and give the user an error). What is a method to reload the page with the proper URL variables?
    The following code does not work:
    pageContext.forward("login.jsp?operation=user_edit&jsessionid=" + f_URLEncode(session.getId()));
    Because it runs from the login.jsp page (the forward command only goes to a new page)

    Just to clarify...
    I log into your site. The first page shown is the CF page. The CF page automatically redirects me to the JSP page. Then what, exactly?
    Does the login page automatically determine my URL, attempt to validate it, and if it doesn't work, it reloads the page?
    The reason I ask is because there is a difference between the resulting HTML page and the JSP class file that generates that HTML page. Generally speaking, most web servers, particularly Tomcat, do not recompile the JSP class file, they just simply pass the parameters to the existing class file, and a new HTML page is generated.
    So technically speaking, every time you visit the login.jsp page, you will get a brand new HTML page. The contents of that page are the same because you presumably pass the same parameters to the class which hasn't changed. But in other words, no, you can't forward to an "old" page that was previously generated by the class - each time the web server calls that class, it creates a "new" page.
    Or are you saying that every time you attempt to forward to the login.jsp page, the system erronously calls the CF page instead?

  • Pages and formatting keeps breaking

    I continue to be frustrated with Pages because I spend a lot of my time managing the layout of my pages and sections as things continually break.
    I move a page within a document, and it breaks the formatting of other nearby pages. I insert a page break and it deletes a section below. I insert a page break and it ***** content to the next section. I try to break out a page into a new section and it inserts a blank page below that can not be removed.
    I am sure there may be reasons for some of this, but I have never had to sped so much time fixing and figuring out. Any recommends?

    Tracy,
    If you had Pages ’09 v4.3 before the Pages v5 upgrade downgrade, then it was moved into /Applications/iWork '09. If you want to return to productivity, you should export any Pages v5 documents back to Pages ’09 format, and then resume using the older application. It simply has 100+ features that were not implemented in Pages v5.
    LibreOffice is powerful, and with that power comes a new learning curve. They do have rather good documentation, too. Try Pages ’09 v4.3 if you have it, and I would recommend exporting each document to a MS Word .doc file, with consistent backups — as Apple future-proofing.

  • Print JTable with Multiple pages and rows

    I took the printing example at http://java.sun.com/developer/onlineTraining/Programming/JDCBook/advprint.html#pe and modified it a bit to include the following:
    1) To Print Multiple pages
    2) To wrap lines that is too long for the column
    3) To print with a more proffesional style, so that it doesn't look like a screen capture is printed
    4) To align the numbers to the right and center column headings
    import javax.swing.*;
    import javax.swing.table.*;
    import java.awt.print.*;
    import java.util.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import java.awt.Dimension;
    import javax.print.*;
    import javax.print.attribute.*;
    import javax.print.attribute.standard.*;
    import java.text.*;
    public class Report implements Printable
         private final int LEFT_ALIGN = -1;
         private final int CENTER_ALIGN = 0;
         private final int RIGHT_ALIGN = 1;
         private JFrame frame;
         private JTable tableView;
         private String lastPrintDate;
         private Font defaultFont;
         private Font headerFont;
         private Font footerFont;
         private int headerHeight;
         private int footerHeight;
         private int cellBuffer = 5;
         private boolean first_pass;
         private ArrayList pages;
         public Report()
              frame = new JFrame("Sales Report");
              frame.addWindowListener(new WindowAdapter()
                   public void windowClosing(WindowEvent e)
                        System.exit(0);
              final String[] headers =
                   "ID",
                   "Description",
                   "open price",
                   "latest price",
                   "End Date",
                   "Quantity"
              int count = 0;
              final Object[][] data =
                   {new Integer(count++), "Box of BirosBox of BirosBox of BirosBox of BirosBox of BirosBox of BirosBox of BirosBox of BirosBox of BirosBox of BirosBox of BirosBox of BirosBox of BirosBox of Biros ppppppppppppppp", "1.00", "4.99", new Date(), new Integer(200000)},
                   {new Integer(count++), "Blue Biro", "0.10", "0.14", new Date(), new Integer(1)},
                   {new Integer(count++), "legal pad", "1.00", "2.49", new Date(), new Integer(1)},
                   {new Integer(count++), "tape", "1.00", "1.49", new Date(), new Integer(1)},
                   {new Integer(count++), "stapler", "4.00", "4.49", new Date(), new Integer(1)},
                   {new Integer(count++), "Box of Biros", "1.00", "4.99", new Date(), new Integer(2)},
                   {new Integer(count++), "Blue Biro", "0.10", "0.14", new Date(), new Integer(1)},
                   {new Integer(count++), "legal pad", "1.00", "2.49", new Date(), new Integer(1)},
                   {new Integer(count++), "tape", "1.00", "1.49", new Date(), new Integer(1)},
                   {new Integer(count++), "stapler", "4.00", "4.49", new Date(), new Integer(1)},
                   {new Integer(count++), "Box of Biros", "1.00", "4.99", new Date(), new Integer(2)},
                   {new Integer(count++), "Blue Biro", "0.10", "0.14", new Date(), new Integer(1)},
                   {new Integer(count++), "legal pad", "1.00", "2.49", new Date(), new Integer(1)},
                   {new Integer(count++), "tape", "1.00", "1.49", new Date(), new Integer(1)},
                   {new Integer(count++), "stapler", "4.00", "4.49", new Date(), new Integer(1)},
                   {new Integer(count++), "Box of Biros", "1.00", "4.99", new Date(), new Integer(2)},
                   {new Integer(count++), "Blue Biro", "0.10", "0.14", new Date(), new Integer(1)},
                   {new Integer(count++), "legal pad", "1.00", "2.49", new Date(), new Integer(1)},
                   {new Integer(count++), "tape", "1.00", "1.49", new Date(), new Integer(1)},
                   {new Integer(count++), "stapler", "4.00", "4.49", new Date(), new Integer(1)},
                   {new Integer(count++),  "Box of Biros", "1.00", "4.99", new Date(), new Integer(2)},
                   {new Integer(count++),  "Blue Biro", "0.10", "0.14", new Date(), new Integer(1)},
                   {new Integer(count++),  "legal pad", "1.00", "2.49", new Date(), new Integer(1)},
                   {new Integer(count++),  "tape", "1.00", "1.49", new Date(), new Integer(1)},
                   {new Integer(count++),  "stapler", "4.00", "4.49", new Date(), new Integer(1)},
                   {new Integer(count++),  "Box of Biros", "1.00", "4.99", new Date(), new Integer(2)},
                   {new Integer(count++),  "Blue Biro", "0.10", "0.14", new Date(), new Integer(1)},
                   {new Integer(count++),  "legal pad", "1.00", "2.49", new Date(), new Integer(1)},
                   {new Integer(count++),  "tape", "1.00", "1.49", new Date(), new Integer(1)},
                   {new Integer(count++),  "stapler", "4.00", "4.49", new Date(), new Integer(1)},
                   {new Integer(count++),  "Box of Biros", "1.00", "4.99", new Date(), new Integer(2)}
              TableModel dataModel = new AbstractTableModel()
                   public int getColumnCount() { return headers.length; }
                   public int getRowCount() { return data.length;}
                   public Object getValueAt(int row, int col)
                        return data[row][col];
                   public String getColumnName(int column)
                        return headers[column];
                   public Class getColumnClass(int col)
                        return getValueAt(0,col).getClass();
                   public boolean isCellEditable(int row, int col)
                        return (col==1);
                   public void setValueAt(Object aValue, int row, int column)
                        data[row][column] = aValue;
              tableView = new JTable(dataModel);
              JScrollPane scrollpane = new JScrollPane(tableView);
              scrollpane.setPreferredSize(new Dimension(500, 80));
              frame.getContentPane().setLayout(new BorderLayout());
              frame.getContentPane().add(BorderLayout.CENTER,scrollpane);
              frame.pack();
              JButton printButton= new JButton();
              printButton.setText("print me!");
              frame.getContentPane().add(BorderLayout.SOUTH,printButton);
              // for faster printing turn double buffering off
              RepaintManager.currentManager(frame).setDoubleBufferingEnabled(false);
              printButton.addActionListener( new ActionListener()
                   public void actionPerformed(ActionEvent evt)
                        doPrint();
              frame.setVisible(true);
          * Reset variables before printing
         private void prepareForPrint()
              pages = new ArrayList();
              first_pass = true;
          * Display a print dialog with some hardcoded defaults
          * The print fonts are also hardcoded
         public void doPrint()
              try
                   String jobName = "Java Report";
                   defaultFont = new Font("Arial", Font.PLAIN, 8);
                   footerFont = new Font("Arial", Font.PLAIN, 6);
                   headerFont = new Font("Arial", Font.BOLD, 10);
                   PrinterJob prnJob = PrinterJob.getPrinterJob();
                   prnJob.setPrintable(this);
                   PrintRequestAttributeSet prnSet = new HashPrintRequestAttributeSet();
                   prnSet.add(new Copies(1));
                   prnSet.add(new JobName(jobName, null));
                   prnSet.add(MediaSizeName.ISO_A4);
                   PageFormat pf = prnJob.defaultPage();
                   pf.setOrientation(java.awt.print.PageFormat.PORTRAIT);
                   prnJob.setJobName(jobName);
                   PrintService[] services = PrinterJob.lookupPrintServices();
                   if (services.length > 0)
                        if (prnJob.printDialog(prnSet))
                              * Get print date
                             String dateFormat = "dd/MM/yyyy HH:mm:ss";
                             DateFormat m_DateFormat = new SimpleDateFormat(dateFormat);
                             lastPrintDate = m_DateFormat.format(new Date()).toString();
                             prepareForPrint();
                             prnJob.print(prnSet);
                   else
                        JOptionPane.showMessageDialog(frame, "No Printer was found!!", "Printer Error", JOptionPane.ERROR_MESSAGE);
                        return;
              catch (PrinterException e)
                   e.printStackTrace();
         public int print(Graphics g, PageFormat pageFormat, int pageIndex) throws PrinterException
               * Check if this is the first time the print method is called for this print action.
               * It is not guaranteed that the print will be called with synchronous pageIndex'es,
               * so we need to calculate the number of pages and which rows appear on which pages.
               * Then the correct page will be printed regardless of which pageIndex is sent through.
              if (first_pass)
                   calcPages(g, pageFormat);
              first_pass = false;
              // Stop printing if the pageIndex is out of range
              if (pageIndex >= pages.size())
                   return NO_SUCH_PAGE;
              Graphics2D     g2 = (Graphics2D) g;
              g2.setColor(Color.black);
              // The footer will be one line at the bottom of the page, cater for this.
              g2.setFont(footerFont);
              footerHeight = g2.getFontMetrics().getHeight() + g2.getFontMetrics().getDescent();
              g2.setFont(defaultFont);
              FontMetrics fontMetrics = g2.getFontMetrics();
              int fontHeight = fontMetrics.getHeight();
              int fontDescent = fontMetrics.getDescent();
              double pageHeight = pageFormat.getImageableHeight() + pageFormat.getImageableY();
              double pageWidth = pageFormat.getImageableWidth();
              double tableWidth = (double) tableView.getColumnModel().getTotalColumnWidth();
              // Shrink or expand the table to fit the page width
              double scale = pageWidth / (tableWidth+ (cellBuffer * tableView.getColumnCount()));
              // Calculate the width in pixels for each column
              double[] columnWidths = new double[tableView.getColumnCount()];
              for(int i = 0; i < tableView.getColumnCount(); i++)
                   columnWidths[i] = (double)tableView.getColumnModel().getColumn(i).getWidth() * scale;
              // Reset the view to the start of the page
              g2.translate(0, 0);
              // Draw a rectangle to see the printable area
              g2.draw3DRect((int)pageFormat.getImageableX(),
                        (int)pageFormat.getImageableY(),
                        (int)pageFormat.getImageableWidth(),
                        (int)pageFormat.getImageableHeight(),
                        false);
              // Calculate the header height
              g2.setFont(headerFont);
              fontMetrics = g2.getFontMetrics();
              // Print the headers and retreive the starting position for the data
              int next_row = printLine(g2, pageFormat, fontMetrics, -1, (int)pageFormat.getImageableY() + fontHeight, columnWidths);
              g2.setFont(defaultFont);
              fontMetrics = g2.getFontMetrics();
              // Start printing the detail
              ArrayList page = (ArrayList)pages.get(pageIndex);
              int start = ((Integer)page.get(0)).intValue();
              int end = ((Integer)page.get(1)).intValue();
              for (int i = start; i <= end; i++)
                   next_row = printLine(g2, pageFormat, fontMetrics, i, next_row, columnWidths);
              // Print the footer
              g2.setFont(footerFont);
              String pageFooter = "Page " + (pageIndex + 1) + " - " + lastPrintDate;
              g2.drawString(pageFooter,
                             (int)pageFormat.getWidth() / 2 - (fontMetrics.stringWidth(pageFooter) / 2),
                             (int)(pageHeight - fontDescent));
              return PAGE_EXISTS;
          * We can't guarantee that the same amount of rows will be displayed on each page,
          * the row heights are dynamic and may wrap onto 2 or more lines.
          * Thus we need to calculate the height of each row and then test how may rows
          * fit on a specific page. eg. Page 1 contains rows 1 to 10, Page 2 contains rows 11 to 15 etc.
         public void calcPages(Graphics g, PageFormat pageFormat) throws PrinterException
              Graphics2D     g2 = (Graphics2D) g;
              g2.setColor(Color.black);
              // The footer will be one line at the bottom of the page, cater for this.
              g2.setFont(footerFont);
              footerHeight = g2.getFontMetrics().getHeight() + g2.getFontMetrics().getDescent();
              g2.setFont(defaultFont);
              FontMetrics fontMetrics = g2.getFontMetrics();
              int fontHeight = fontMetrics.getHeight();
              int fontDescent = fontMetrics.getDescent();
              double pageHeight = pageFormat.getImageableHeight() - fontHeight;
              double pageWidth = pageFormat.getImageableWidth();
              double tableWidth = (double) tableView.getColumnModel().getTotalColumnWidth();
              // Shrink or expand the table to fit the page width
              double scale = pageWidth / (tableWidth+ (cellBuffer * tableView.getColumnCount()));
              // Calculate the width in pixels for each column
              double[] columnWidths = new double[tableView.getColumnCount()];
              for(int i = 0; i < tableView.getColumnCount(); i++)
                   columnWidths[i] = (double)tableView.getColumnModel().getColumn(i).getWidth() * scale;
              // Calculate the header height
              int maxHeight = 0;
              g2.setFont(headerFont);
              fontMetrics = g2.getFontMetrics();
              for (int j = 0; j < tableView.getColumnCount(); j++)
                   String value = tableView.getColumnName(j).toString();
                   int numLines = (int)Math.ceil(fontMetrics.stringWidth(value) / columnWidths[j]);
                   if (numLines > maxHeight)
                        maxHeight = numLines;
              headerHeight = g2.getFontMetrics().getHeight() * maxHeight;
              g2.setFont(defaultFont);
              fontMetrics = g2.getFontMetrics();
              int pageNum = 0;
              int bottom_of_page = (int)(pageFormat.getImageableHeight() + pageFormat.getImageableY()) - footerHeight;
              int prev_row = 0;
              int next_row = (int)pageFormat.getImageableY() + fontHeight + headerHeight;
              int i = 0;
              ArrayList page = new ArrayList();
              page.add(new Integer(0));
              for (i = 0; i < tableView.getRowCount(); i++)
                   maxHeight = 0;
                   for (int j = 0; j < tableView.getColumnCount(); j++)
                        String value = tableView.getValueAt(i, j).toString();
                        int numLines = (int)Math.ceil(fontMetrics.stringWidth(value) / columnWidths[j]);
                        if (numLines > maxHeight)
                             maxHeight = numLines;
                   prev_row = next_row;
                   next_row += (fontHeight * maxHeight);
                   // If we've reached the bottom of the page then set the current page's end row
                   if (next_row > bottom_of_page)
                        page.add(new Integer(i - 1));
                        pages.add(page);
                        page = new ArrayList();
                        page.add(new Integer(i));
                        pageNum++;
                        next_row = (int)pageFormat.getImageableY()
                                       + fontHeight
                                       + ((int)pageFormat.getHeight() * pageNum)
                                       + headerHeight;
                        bottom_of_page = (int)(pageFormat.getImageableHeight()
                                            + pageFormat.getImageableY())
                                            + ((int)pageFormat.getHeight() * pageNum)
                                            - footerHeight;
                        //Include the current row on the next page, because there is no space on this page
                        i--;
              page.add(new Integer(i - 1));
              pages.add(page);
          * Print the headers or a row from the table to the graphics context
          * Return the position of the row following this one
         public int printLine(Graphics2D g2,
                                       PageFormat pageFormat,
                                       FontMetrics fontMetrics,
                                       int rowNum,
                                       int next_row,
                                       double[] columnWidths)
                   throws PrinterException
              int lead = 0;
              int maxHeight = 0;
              for (int j = 0; j < tableView.getColumnCount(); j++)
                   String value = null;
                   int align = LEFT_ALIGN;
                   if (rowNum > -1)
                        Object obj = tableView.getValueAt(rowNum, j);
                        if (obj instanceof Number)
                             align = RIGHT_ALIGN;
                        value = obj.toString();
                   else
                        align = CENTER_ALIGN;
                        value = tableView.getColumnName(j);
                   int numLines = (int)Math.ceil(fontMetrics.stringWidth(value) / columnWidths[j]);
                   if (numLines > maxHeight)
                        maxHeight = numLines;
                   if (fontMetrics.stringWidth(value) < columnWidths[j])
                        // Single line
                        int offset = 0;
                        // Work out the offset from the start of the column to display alignment correctly
                        switch (align)
                             case RIGHT_ALIGN: offset = (int)(columnWidths[j] - fontMetrics.stringWidth(value)); break;
                             case CENTER_ALIGN: offset = (int)(columnWidths[j] - fontMetrics.stringWidth(value)) / 2; break;
                             default: offset = 0; break;
                        g2.drawString(value,
                                       lead + (int)(pageFormat.getImageableX() + offset),
                                       next_row);
                   else
                        for(int a = 0; a < numLines; a++)
                             //Multi-Line
                             int x = 0;
                             int width = 0;
                             for(x = 0; x < value.length(); x++)
                                  width += fontMetrics.charWidth(value.charAt(x));
                                  if (width > columnWidths[j])
                                       break;
                             int offset = 0;
                             // Work out the offset from the start of the column to display alignment correctly
                             switch (align)
                                  case RIGHT_ALIGN: offset = (int)(columnWidths[j] - fontMetrics.stringWidth(value)); break;
                                  case CENTER_ALIGN: offset = (int)(columnWidths[j] - fontMetrics.stringWidth(value)) / 2; break;
                                  default: offset = 0; break;
                             g2.drawString(value.substring(0, x),
                                            lead + (int)(pageFormat.getImageableX() + offset),
                                            next_row + (fontMetrics.getHeight() * a));                    
                             value = value.substring(x);
                   lead += columnWidths[j] + cellBuffer;
              // Draw a solid line below the row
              g2.draw(new Line2D.Double(pageFormat.getImageableX(),
                             next_row + (fontMetrics.getHeight() * (maxHeight - 1)) + fontMetrics.getDescent(),
                             pageFormat.getImageableY() + pageFormat.getImageableWidth(),
                             next_row + (fontMetrics.getHeight() * (maxHeight - 1)) + fontMetrics.getDescent()));
              // Return the position of the row following this one
              return next_row + (fontMetrics.getHeight() * maxHeight);
         public static void main(String[] args)
              new Report();
    }

    Fixed some bugs and added a title. Just pass in a JTable and the class will do the rest.
    import javax.swing.*;
    import javax.swing.table.*;
    import java.awt.print.*;
    import java.util.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import javax.print.*;
    import javax.print.attribute.*;
    import javax.print.attribute.standard.*;
    import java.text.*;
    import java.math.*;
    public class PrintJTable implements Printable
         private final int LEFT_ALIGN = -1;
         private final int CENTER_ALIGN = 0;
         private final int RIGHT_ALIGN = 1;
         private JFrame m_parent;
         private String m_title;
         private JTable tableView;
         private String lastPrintDate;
         private Font defaultFont;
         private Font headerFont;
         private Font footerFont;
         private int headerHeight;
         private int footerHeight;
         private int cellBuffer = 5;
         private boolean first_pass;
         private ArrayList pages;
         public PrintJTable(JFrame parent, JTable table)
              m_parent = parent;
              tableView = table;
              doPrint();
         public PrintJTable(JFrame parent, String title, JTable table)
              m_parent = parent;
              m_title = title;
              tableView = table;
              doPrint();
          * Reset variables before printing
         private void prepareForPrint()
              pages = new ArrayList();
              first_pass = true;
          * Display a print dialog with some hardcoded defaults
          * The print fonts are also hardcoded
         public void doPrint()
              try
                   String jobName = "Java Report";
                   defaultFont = new Font("Arial", Font.PLAIN, 8);
                   footerFont = new Font("Arial", Font.PLAIN, 6);
                   headerFont = new Font("Arial", Font.BOLD, 8);
                   PrinterJob prnJob = PrinterJob.getPrinterJob();
                   prnJob.setPrintable(this);
                   PrintRequestAttributeSet prnSet = new HashPrintRequestAttributeSet();
                   prnSet.add(new Copies(1));
                   prnSet.add(new JobName(jobName, null));
                   prnSet.add(MediaSizeName.ISO_A4);
                   PageFormat pf = prnJob.defaultPage();
                   pf.setOrientation(java.awt.print.PageFormat.PORTRAIT);
                   prnJob.setJobName(jobName);
                   PrintService[] services = PrinterJob.lookupPrintServices();
                   if (services.length > 0)
                        if (prnJob.printDialog(prnSet))
                              * Get print date
                             String dateFormat = "dd/MM/yyyy HH:mm:ss";
                             DateFormat m_DateFormat = new SimpleDateFormat(dateFormat);
                             lastPrintDate = m_DateFormat.format(new Date()).toString();
                             prepareForPrint();
                             prnJob.print(prnSet);
                   else
                        JOptionPane.showMessageDialog(m_parent, "No Printer was found!!", "Printer Error", JOptionPane.ERROR_MESSAGE);
                        return;
              catch (PrinterException e)
                   e.printStackTrace();
         public int print(Graphics g, PageFormat pageFormat, int pageIndex) throws PrinterException
               * Check if this is the first time the print method is called for this print action.
               * It is not guaranteed that the print will be called with synchronous pageIndex'es,
               * so we need to calculate the number of pages and which rows appear on which pages.
               * Then the correct page will be printed regardless of which pageIndex is sent through.
              if (first_pass)
                   calcPages(g, pageFormat);
              first_pass = false;
              // Stop printing if the pageIndex is out of range
              if (pageIndex >= pages.size())
                   return NO_SUCH_PAGE;
              Graphics2D     g2 = (Graphics2D) g;
              g2.setColor(Color.black);
              // The footer will be one line at the bottom of the page, cater for this.
              g2.setFont(footerFont);
              footerHeight = g2.getFontMetrics().getHeight() + g2.getFontMetrics().getDescent();
              g2.setFont(defaultFont);
              FontMetrics fontMetrics = g2.getFontMetrics();
              int fontHeight = fontMetrics.getHeight();
              int fontDescent = fontMetrics.getDescent();
              double pageHeight = pageFormat.getImageableHeight() + pageFormat.getImageableY();
              double pageWidth = pageFormat.getImageableWidth();
              double tableWidth = (double) tableView.getColumnModel().getTotalColumnWidth();
              // Shrink or expand the table to fit the page width
              double scale = (pageWidth - (cellBuffer * tableView.getColumnCount())) / tableWidth;
              // Calculate the width in pixels for each column
              double[] columnWidths = new double[tableView.getColumnCount()];
              double test = 0;
              for(int i = 0; i < tableView.getColumnCount(); i++)
                   columnWidths[i] = (double)Math.floor(tableView.getColumnModel().getColumn(i).getWidth() * scale);
                   test += columnWidths;
              // Reset the view to the start of the page
              g2.translate(0, 0);
              // Draw a rectangle to see the printable area
              g2.draw3DRect((int)pageFormat.getImageableX(),
                        (int)pageFormat.getImageableY(),
                        (int)pageFormat.getImageableWidth(),
                        (int)pageFormat.getImageableHeight(),
                        false);
              // Calculate the header height
              g2.setFont(headerFont);
              fontMetrics = g2.getFontMetrics();
              // Print the headers and retreive the starting position for the data
              int next_row = (int)pageFormat.getImageableY() + fontMetrics.getHeight();
              if ((m_title != null) && (!m_title.equalsIgnoreCase("")))
                   g2.drawString(m_title,
                                       (int)(pageFormat.getImageableX()),
                                       next_row);
                   Color current_color = g2.getColor();
                   g2.setColor(Color.lightGray);
                   int y = next_row + fontMetrics.getDescent();
                   g2.draw(new Line2D.Double(pageFormat.getImageableX(),
                                  y,
                                  (pageFormat.getImageableY() + pageFormat.getImageableWidth()),
                                  y));
                   g2.setColor(current_color);
                   next_row += fontMetrics.getHeight();
              next_row = printLine(g2, pageFormat, fontMetrics, -1, next_row, columnWidths);
              g2.setFont(defaultFont);
              fontMetrics = g2.getFontMetrics();
              // Start printing the detail
              ArrayList page = (ArrayList)pages.get(pageIndex);
              int start = ((Integer)page.get(0)).intValue();
              int end = ((Integer)page.get(1)).intValue();
              for (int i = start; i <= end; i++)
                   next_row = printLine(g2, pageFormat, fontMetrics, i, next_row, columnWidths);
              // Print the footer
              g2.setFont(footerFont);
              String pageFooter = "Page " + (pageIndex + 1) + " - " + lastPrintDate;
              g2.drawString(pageFooter,
                             (int)pageFormat.getWidth() / 2 - (fontMetrics.stringWidth(pageFooter) / 2),
                             (int)(pageHeight - fontDescent));
              return PAGE_EXISTS;
         * We can't guarantee that the same amount of rows will be displayed on each page,
         * the row heights are dynamic and may wrap onto 2 or more lines.
         * Thus we need to calculate the height of each row and then test how may rows
         * fit on a specific page. eg. Page 1 contains rows 1 to 10, Page 2 contains rows 11 to 15 etc.
         public void calcPages(Graphics g, PageFormat pageFormat) throws PrinterException
              Graphics2D     g2 = (Graphics2D) g;
              g2.setColor(Color.black);
              // The footer will be one line at the bottom of the page, cater for this.
              g2.setFont(footerFont);
              footerHeight = g2.getFontMetrics().getHeight() + g2.getFontMetrics().getDescent();
              g2.setFont(defaultFont);
              FontMetrics fontMetrics = g2.getFontMetrics();
              int fontHeight = fontMetrics.getHeight();
              int fontDescent = fontMetrics.getDescent();
              double pageHeight = pageFormat.getImageableHeight() - fontHeight;
              double pageWidth = pageFormat.getImageableWidth();
              double tableWidth = (double) tableView.getColumnModel().getTotalColumnWidth();
              // Shrink or expand the table to fit the page width
              double scale = (pageWidth - (cellBuffer * tableView.getColumnCount())) / tableWidth;
              // Calculate the width in pixels for each column
              double[] columnWidths = new double[tableView.getColumnCount()];
              for(int i = 0; i < tableView.getColumnCount(); i++)
                   columnWidths[i] = (double)Math.floor(tableView.getColumnModel().getColumn(i).getWidth() * scale);
              // Calculate the header height
              int maxHeight = 0;
              g2.setFont(headerFont);
              fontMetrics = g2.getFontMetrics();
              headerHeight = 0;
              if ((m_title != null) && (!m_title.equalsIgnoreCase("")))
                   headerHeight = fontMetrics.getHeight();
              for (int j = 0; j < tableView.getColumnCount(); j++)
                   String value = tableView.getColumnName(j).toString();
                   int numLines = (int)Math.ceil(fontMetrics.stringWidth(value) / columnWidths[j]);
                   if (numLines > maxHeight)
                        maxHeight = numLines;
              headerHeight += g2.getFontMetrics().getHeight() * maxHeight;
              g2.setFont(defaultFont);
              fontMetrics = g2.getFontMetrics();
              int pageNum = 0;
              int bottom_of_page = (int)(pageFormat.getImageableHeight() + pageFormat.getImageableY()) - footerHeight;
              int prev_row = 0;
              int next_row = (int)pageFormat.getImageableY() + fontHeight + headerHeight;
              int i = 0;
              ArrayList page = new ArrayList();
              page.add(new Integer(0));
              for (i = 0; i < tableView.getRowCount(); i++)
                   maxHeight = 0;
                   for (int j = 0; j < tableView.getColumnCount(); j++)
                        String value = formatObject(tableView.getValueAt(i, j));
                        int numLines = (int)Math.ceil(fontMetrics.stringWidth(value) / columnWidths[j]);
                        if (numLines > maxHeight)
                             maxHeight = numLines;
                   prev_row = next_row;
                   next_row += (fontHeight * maxHeight);
                   // If we've reached the bottom of the page then set the current page's end row
                   if (next_row > bottom_of_page)
                        page.add(new Integer(i - 1));
                        pages.add(page);
                        page = new ArrayList();
                        page.add(new Integer(i));
                        pageNum++;
                        next_row = (int)pageFormat.getImageableY()
                                       + fontHeight
                                       + ((int)pageFormat.getHeight() * pageNum)
                                       + headerHeight;
                        bottom_of_page = (int)(pageFormat.getImageableHeight()
                                            + pageFormat.getImageableY())
                                            + ((int)pageFormat.getHeight() * pageNum)
                                            - footerHeight;
                        //Include the current row on the next page, because there is no space on this page
                        i--;
              page.add(new Integer(i - 1));
              pages.add(page);
         * Print the headers or a row from the table to the graphics context
         * Return the position of the row following this one
         public int printLine(Graphics2D g2,
                                       PageFormat pageFormat,
                                       FontMetrics fontMetrics,
                                       int rowNum,
                                       int next_row,
                                       double[] columnWidths)
                   throws PrinterException
              int lead = 0;
              int maxHeight = 0;
              for (int j = 0; j < tableView.getColumnCount(); j++)
                   String value = null;
                   int align = LEFT_ALIGN;
                   if (rowNum > -1)
                        Object obj = tableView.getValueAt(rowNum, j);
                        if (obj instanceof Number)
                             align = RIGHT_ALIGN;
                        value = formatObject(obj);
                   else
                        //align = CENTER_ALIGN;
                        value = tableView.getColumnName(j);
                   int numLines = (int)Math.ceil(fontMetrics.stringWidth(value) / columnWidths[j]);
                   if (numLines > maxHeight)
                        maxHeight = numLines;
                   if (fontMetrics.stringWidth(value) < columnWidths[j])
                        // Single line
                        int offset = 0;
                        // Work out the offset from the start of the column to display alignment correctly
                        switch (align)
                             case RIGHT_ALIGN: offset = (int)(columnWidths[j] - fontMetrics.stringWidth(value)); break;
                             case CENTER_ALIGN: offset = (int)(columnWidths[j] - fontMetrics.stringWidth(value)) / 2; break;
                             default: offset = 0; break;
                        g2.drawString(value,
                                       lead + (int)(pageFormat.getImageableX() + offset),
                                       next_row);
                   else
                        for(int a = 0; a < numLines; a++)
                             //Multi-Line
                             int x = 0;
                             int width = 0;
                             for(x = 0; x < value.length(); x++)
                                  width += fontMetrics.charWidth(value.charAt(x));
                                  if (width > columnWidths[j])
                                       break;
                             int offset = 0;
                             // Work out the offset from the start of the column to display alignment correctly
                             switch (align)
                                  case RIGHT_ALIGN: offset = (int)(columnWidths[j] - fontMetrics.stringWidth(value.substring(0, x))); break;
                                  case CENTER_ALIGN: offset = (int)(columnWidths[j] - fontMetrics.stringWidth(value.substring(0, x))) / 2; break;
                                  default: offset = 0; break;
                             g2.drawString(value.substring(0, x),
                                            lead + (int)(pageFormat.getImageableX() + offset),
                                            next_row + (fontMetrics.getHeight() * a));                    
                             value = value.substring(x);
                   lead += columnWidths[j] + cellBuffer;
              // Draw a solid line below the row
              Color current_color = g2.getColor();
              g2.setColor(Color.lightGray);
              int y = next_row + (fontMetrics.getHeight() * (maxHeight - 1)) + fontMetrics.getDescent();
              g2.draw(new Line2D.Double(pageFormat.getImageableX(),
                             y,
                             (pageFormat.getImageableY() + pageFormat.getImageableWidth()),
                             y));
              g2.setColor(current_color);
              // Return the position of the row following this one
              return next_row + (fontMetrics.getHeight() * maxHeight);
         public String formatObject(Object obj)
              String value = (obj == null) ? "" : obj.toString();
              return value;

  • How do I get a section break/page break when the item is greyed out?

    I've created an A4 document in word processing mode, with four identical A6 text boxes covering the entire page. Then I've created a second page with four more A6 text boxes so I can print a postcard on both sides of the card. Trouble is, Pages has made two extra text pages that I don't want, the first is linked to Pages 1 and 2, and the second is separate. I can't create a section break or page break because the command is greyed out, so I can't delete page 3. When I try and delete page 4, which is a stand alone page, it also deletes pages 2,3 and 4, leaving me with just page 1!
    I don't have any problem with page breaks or section breaks in an ordinary A4 document with just one text box on a page, but I often want to create multiple text boxes and when I do I have always had this problem, ever since Pages was first introduced. Can anyone tell me what I'm doing wrong, please?

    Thank you, Yvan, but I've tried that. Firstly, I unchecked the headers and footers tick box in the Inspector because I want the postcards to be exactly A6 size, that is, one quarter of A4. I've tried making the lower two text boxes slightly smaller (which I don't really want to do, because I want them A6 size) but I still can't get the insertion point to appear below the text box – it stays resolutely in the next page and won't go back up to the previous page. Any further ideas? Thank you.

  • Problem with "Next Page" And "Zoom" in CrystalReportViewer With VS 2010

    Hello,
    i am using crystal report v 13 sp1 with visual studio 2010,
    As mebtioned, the next page and the zoom is not working in my report, whiwh has as data source "Stored Procedure"
    This is my code, and i think it's correct, i was using this code in previous versions of crystal report (cr10) and it worked fine,
    When i used the Data set , the next page and zoom worked fine, but with stored procedure it doesn't work,
    Note: when i open the Tree of Data on the left, then click on the next page or the zoom, it become funtional, it's very weird,
    protected void *Page_Init*(object sender, EventArgs e)
    if (!IsPostBack)
    reportDocument = (ReportDocument)this.Page.Session ["_reportDocument"];
    if (reportDocument != null)
    string rptFile = reportDocument.FileName.Split('
    ', '/').Last();
    LoadReportRessource(reportDocument);
    TableLogOnInfo log = new TableLogOnInfo();
    ConnectionStringSettings conn = WebConfigurationManager.ConnectionStrings[0]; //la premiere connectionstring
    SqlConnectionStringBuilder SConn = new SqlConnectionStringBuilder(conn.ConnectionString);
    log.ConnectionInfo.ServerName = SConn.DataSource;
    log.ConnectionInfo.DatabaseName = SConn.InitialCatalog;
    log.ConnectionInfo.UserID = SConn.UserID;
    log.ConnectionInfo.Password = SConn.Password;
    log.ConnectionInfo.Type = ConnectionInfoType.SQL;
    for (int i = 0; i < reportDocument.Database.Tables.Count; i++)
    reportDocument.Database.Tables.ApplyLogOnInfo(log);
    for (int i = 0; i < CrystalReportViewer1.LogOnInfo.Count; i++)
    CrystalReportViewer1.LogOnInfo.ConnectionInfo = log.ConnectionInfo;
    CrystalReportViewer1.ParameterFieldInfo = (ParameterFields)this.Page.Session ["_paramFields"];
    CrystalReportViewer1.ReportSource = reportDocument;
    CrystalReportViewer1.DataBind();
    CrystalReportViewer1.ShowFirstPage();
    else
    CrystalReportViewer1.ReportSource = (ReportDocument)this.Page.Session ["_reportDocument"] ;
    Edited by: Soumaya on Sep 7, 2011 6:16 PM

    @Don:
    Sorry, but i donno what do you mean by "what is the App Pool running in 32 or 64 bit?",
    i am running the application locally, ( the IIS is installed locally ),
    as i told you, my OS is 64bit,
    And yes i tried a very simple report, with just one field , and the "next button" is also not working,
    Its only not working with stored procedure, in the others methods ( push or pull method is working fine)
    i think its a problem in refreshing page, because when i open the tree on the left, then click on next page or zoom, its works fine
    @Ludek:
    i changed my code as below, and it doesn't solve my problem:
            ReportDocument reportDocument;
            protected void Page_Init(object sender, EventArgs e)
                if (!IsPostBack)
                    reportDocument = (ReportDocument)this.Page.Session["_reportDocument"];
                    if (reportDocument != null)
                        string rptFile = reportDocument.FileName.Split('
    ', '/').Last();
                            TableLogOnInfo log = new TableLogOnInfo();
                            ConnectionStringSettings conn = WebConfigurationManager.ConnectionStrings[0];
                            SqlConnectionStringBuilder SConn = new SqlConnectionStringBuilder(conn.ConnectionString);
                            log.ConnectionInfo.ServerName = SConn.DataSource;
                            log.ConnectionInfo.DatabaseName = SConn.InitialCatalog;
                            log.ConnectionInfo.UserID = SConn.UserID;
                            log.ConnectionInfo.Password = SConn.Password;
                            log.ConnectionInfo.Type = ConnectionInfoType.SQL;
                            for (int i = 0; i < reportDocument.Database.Tables.Count; i++)
                                reportDocument.Database.Tables<i>.ApplyLogOnInfo(log);
                        this.Page.Session["_reportDocument"] = reportDocument;
                        CrystalReportViewer1.ParameterFieldInfo = (ParameterFields)this.Page.Session["_paramFields"];
                        CrystalReportViewer1.ReportSource = reportDocument;
                        CrystalReportViewer1.ShowFirstPage();
                else
                    CrystalReportViewer1.ReportSource = this.Page.Session["_reportDocument"];
    Edited by: Soumaya on Sep 8, 2011 10:39 AM

  • How to get inputted value in a RTE field on custom page and submit by REST call in 'Sharepoint hosted app'.

    Hi I am facing the three questions below.
    1. How to use default RTE in custom page in Sharepoint hosted app.
     I saw the article of Rich text Editor (ribbon based) in a webpart in SharePoint 2013 and tried it. But it did not work well. I guess it needs code-behind setting, however sharepoint hosted app does not support code-behind.
    Does anybody know how to do this?
    2. In above case, I placed the below code on custom page and tried to get the field's value when submit button was clicked.
    <SharePoint:InputFormTextBox ID="rftDefaultValue"
    RichText="true"
    RichTextMode="FullHtml" runat="server"
    TextMode="MultiLine" Rows="5">
    </SharePoint:InputFormTextBox>
    In debugger, the returned value was 'undefined'.
    var note = $('#hogehoge').val();
    Is it possible to get the RTE value? If yes, please let me know how to do this.
    3. I need to submit the RTE value using REST call.
    In this
    article in MSDN, the item creation sample treats single line text field. Does anybody know the sample for RTE?

    Hi,
    According to your description, you might want to use Rich Text Editor control in your SharePoint hosted app.
    First of all, I would suggest you post one question in one thread to make it easier to be discussed, which would also help you get a quick solution.
    Though we can add this control into a SharePoint hosted app, however, as we can’t add code behind for it, plus with the potential compatibility issues in different
    browsers, I would suggest you use other JavaScript Rich Text Editor plugins instead.
    Two JavaScript Rich Text Editor plugins for your reference:
    http://quilljs.com/
    http://nicedit.com/
    If you want to submit the value of Rich Text Editor control to a SharePoint list using REST call, since the content in the Multiple Line of Text column is wrapped
    with nested HTML tags, the similar requirement would also be applied to the content to be submitted.
    Here is a code snippet about how to update a Multiple Line of Text column for your reference:
    updateListItem(_spPageContextInfo.webAbsoluteUrl, "List018", 1);
    function updateListItem(siteUrl, listName, itemId)
    var itemType = GetItemTypeForListName(listName);
    var item = {
    "__metadata": { "type": itemType },
    "MultiTextEnhanced": "<div><a href='http://bing.com/'>Bing</a><br></p></div>",
    "Title": "123"
    $.ajax({
    url: siteUrl + "/_api/web/lists/getbytitle('" + listName + "')/items(" + itemId + ")",
    method: "GET",
    headers: { "Accept": "application/json; odata=verbose" },
    success: function (data) {
    console.log(data);
    $.ajax({
    url: data.d.__metadata.uri,
    type: "POST",
    contentType: "application/json;odata=verbose",
    data: JSON.stringify(item),
    headers: {
    "Accept": "application/json;odata=verbose",
    "X-RequestDigest": $("#__REQUESTDIGEST").val(),
    "X-HTTP-Method": "MERGE",
    "If-Match": data.d.__metadata.etag
    success: function (data) {
    console.log(data);
    error: function (data) {
    console.log(data);
    error: function (data) {
    console.log(data);
    // Getting the item type for the list
    function GetItemTypeForListName(name)
    return"SP.Data." + name.charAt(0).toUpperCase() + name.slice(1) + "ListItem";
    Thanks
    Patrick Liang
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support,
    contact [email protected]
    Patrick Liang
    TechNet Community Support

  • Edit User Profile How do I enalble user lo loggin to their own profile page and edit it?

    Hi
    I am having some problems....... any help would be nice
    I am using DWCS3 and ADDT toolbox extension wamp and phpmyadmin
    I am trying to create a site for people to be able to post a profile with a picture and info and display it in a dynamic table.
    I can create the form, a database and display the data on another page in a dynamic table all ok..... kind of.
    I can create a user registration system with ADDT.
    I can redirect them after registration to a post profile page, which has a form to upload details. I can then display those details on a user info page.
    I would like to allow logged in users to be able to click on a link to their own profile page , which would show the same form that was filled out in the post profile page, but would be already populated with their previously entered information. I would like users to be able to edit the content of the form and update the information in the database and automatically delete delete any previously entered information ( only in the fields that have been edited)
    How do I go about doing this?.... step by step?
    I want to allow logged in user to view their own profile not every bodies.... how do I do that?
    I have read on another post that to do something similar to this I should filter my database information using a session varialble MM_username that I think is created automatically after user logs in .... but I don;t know how to do this.... I really don;t understand is this the way I link my user to a page that only displays their info ? or is there another way?
    I would also like to allow only people who have posted a profile to be able to edit profile ...... do I do that by
    1. new user registers and is redirected to login page
    2. user logs in and is redirected to an index page that has a post profile button and a edit profile button but only the POST button is active ( and links to a form to post info ) and the edit profile button is linked to a " You must post a profile first" page ( with a link back)
    3 so user posts profile and is directed to an index page which has an edit profile button which is now linked to an edit profile page
    Does that sound correct?
    Any suggestions in getting all this to work would be much appreciated

    Hi Yomi,
    I have created the users page which submits to a members page and tell the user to edit biodata, profession, and hobbies. but on clicking I am really confused on how the id will be transfered from the members page to update biodata and the user updates the form which will show past records. this should also apply to the profession and hobbies
    If I understand this right, you might want to consider providing a complete "userdata" section which comes with a Dynamic List and a Dynamic Form to have users add & update their data plus (via the Dynamic List) track all past records
    Lastly is it possible I create recordset at will and the id will be passed thru since kt-login-id behaves sololy
    I really can´t recommend this "pass user_id as URL variable" approach in this case, as URL variables are displayed in the browser´s address bar -- and this is absolutely insecure, because anyone could simply change the displayed "user_id" value, reload the form and hence edit data which belongs to a different user.
    The only secure method is indeed to use ADDT´s session variable kt_login_id
    Fatal error: Call to undefined function: var_export()
    Not sure, but maybe some "includes" files haven´t been generated
    Cheers,
    Günter Schenk
    Adobe Community Expert, Dreamweaver

  • How can I stop the execution on a JSP page and start it again

    Hi
    I am making a program that simulates how to manage transactions when accessing a database by using locks. I have run into a problem and I hope someone has the time to help me.
    When a user does an update the transaction commits and releases its locks when the program executes
    <%stmt.executeUpdate("commit!"); %>
    I need to put a break in to stop the program executing this statement, to illustrate the lock is set correctly.
    I have tried to put in an alert box but this does not prevent the rest of the java code being executed.
    I have tried to use prompt boxes, JavaScript functions, but these functions cannot have any java code in them.
    I have tried using the java.swing JOptionPane boxes but this didn?t work either
    I have tried to get input from the user but I don?t know how to retrieve this data on the same page. (As far as I know you have to use submit and even refresh the page or retrieve it on the next page).
    Does anyone know how I can stop the execution on a JSP page and start it again (on same page)
    Mette

    I already have another client (Tomcat jsp application) running and it throws a SQLException correctly when I don�t put in a commit=true statement and don't close the database connection.
    But the problem is how to get the code above to stop to illustrate I have set this lock.
    I have tried to use the JOptionPane but because my program is running in a web browser I cannot use the JOptionPane dialog box.
    I have tired using an alert box but it executes the commit statement before the alert box is dispayed. So this does not work
    While (i < 2)
    if( i==1)
    %>alert(�The transactions commits when you press Ok�); <% //what it to stop execution here
    else
    stmt.executeUpdate(�commit�);
    I am not using threads so I cannot use the sleep function.
    I am using mysql and have already configured it to detect deadlocks and how long to wait for locks.
    Thanks for your help
    Mette

  • Is there a way to make the Bing Translator Attribution to not float on a page and to place it in a specific location?

    I have found a way to place the widget TRANSLATE button in a specific place on a page however the the return from the translate method from the widget is placing the Attribution in the same location each time as well as making it floating meaning I can move
    it around where ever I want to by click and dragging.  
    The problem with the attribution is that it covers up content on the page and after each page link the end user needs to move it out of the way again.  This could be more of a nuisance to potential customers.  
    With that said is there a way to force the control that is returned from the widget to be forced to a certain location and have the floating disabled?
    Thanks

    Hi Will, in upcoming releases we are working towards more flexibility in terms of placement of the floating widget. We will post on our blog and the forums when we push this out.
    Vikram Dendi, Director of Product Management
    Microsoft Translator

  • How can I save a page and all its component parts in a single file, like IE does as an MHT - it's much easier for mailing to people where page address not available?? (as in output from an airline booking site, for example)

    how can I save a page and all its component parts in a single file, like IE does as an MHT?
    It's much easier for mailing to people where page address not available?? (as in output from an airline booking site, for example)
    It is simply too painful to have to zip everything up into a single file to send. MHT format has been available for years now from IE, and with every new FF release it's the first thing I look for. I have been using FF for years, and hate having to come out of it, over into IE |(which I even took out of startup) and key everything in again, in order to send somebody something in a convenient format that they can open with a single click.
    I can't believe this hasn't been asked before, so have you looked at it and rejected it? Have MS kept the file format secret?
    Thanks
    MG

    This is not really an answer just my comments on your question.
    I am sure I recollect efforts being made to get mhtml to work with FF.
    Probably the important thing to remember about .mhtml is that if other browsers do support it they may need addons, and may not necessarily render the content correctly/consistently.
    There are FF addons designed for archiving webpages, you could try them, but that then assumes the recipient has the same software.
    You could simply save the page from FF to your XP pc; then offline open it with and save it using IE, before then emailing using FF, and attaching the .mht or mhtml file that you have now created on your PC.
    As an alternative method, in some cases it could be worth considering taking a screen grab of the required page, then sending that to the recipient as a single email attatchment using either a bitmap or jpeg file format for instance.
    Something such as an airline booking may be designed with a print option, possibly it could be worthwile looking at sending the print file itself as an email attachment.

  • Issue with calling a  method activity before page render

    Hi All,
    I am using Jdeveloper 11.1.1.7.
    I am trying to achieve the approach defined in "1.b. Calling a Method in Backing Bean:" elaborated in the blog - https://blogs.oracle.com/adf/entry/an_epic_question_how_to
    As illustrated, I defined a default method activity (binding to a method in managed bean) and a view activity activity in a bounded task flow.
    When I launch the application (running the view activity), following error is encountered -
    oracle.adf.controller.metadata.ParsingException: ADFC-02020: Cannot find default activity 'check' in task flow definition '/WEB-INF/task-flow-definition.xml#task-flow-definition'.
        at oracle.adfinternal.controller.metadata.model.xml.XmlUtil.createAndLogParsingException(XmlUtil.java:474)
        at oracle.adfinternal.controller.metadata.model.xml.MetadataResourceXmlImpl.parseTaskFlowDefinition(MetadataResourceXmlImpl.java:507)
        at oracle.adfinternal.controller.metadata.model.xml.MetadataResourceXmlImpl.parse(MetadataResourceXmlImpl.java:361)
        at oracle.adfinternal.controller.metadata.provider.mds.MdsMetadataResourceProvider.parseResource(MdsMetadataResourceProvider.java:748)
        at oracle.adfinternal.controller.metadata.provider.mds.MdsMetadataResourceProvider.getMDSCachedResourceOrParse(MdsMetadataResourceProvider.java:732)
    Please advise.
    Best Regards,
    Ankit Gupta

    Hi Cvele, Timo,
    Many thanks for the suggestions.
    To avoid confusions, I have created a new application altogether. It seems that the method call is not being called when I run the page.
    For your reference I have attached the task flow definition and method code below -
    Task Flow Definition
    <?xml version="1.0" encoding="windows-1252" ?>
    <adfc-config xmlns="http://xmlns.oracle.com/adf/controller" version="1.2">
      <task-flow-definition id="task-flow-definition">
        <default-activity id="__1">methodCall1</default-activity>
        <managed-bean id="__11">
          <managed-bean-name id="__13">TestBean</managed-bean-name>
          <managed-bean-class id="__10">TestBean</managed-bean-class>
          <managed-bean-scope id="__12">request</managed-bean-scope>
        </managed-bean>
        <view id="view1">
          <page>/view1.jspx</page>
        </view>
        <view id="exception">
          <page>/exception.jspx</page>
        </view>
        <method-call id="methodCall1">
          <method>#{requestScope.TestBean.checkURL}</method>
          <return-value id="__15">#{TestBean.checkURL}</return-value>
          <outcome id="__14">
            <to-string/>
          </outcome>
        </method-call>
        <control-flow-rule id="__2">
          <from-activity-id id="__3">methodCall1</from-activity-id>
          <control-flow-case id="__5">
            <from-outcome id="__6">go</from-outcome>
            <to-activity-id id="__4">view1</to-activity-id>
          </control-flow-case>
          <control-flow-case id="__8">
            <from-outcome id="__9">error</from-outcome>
            <to-activity-id id="__7">exception</to-activity-id>
          </control-flow-case>
        </control-flow-rule>
      </task-flow-definition>
    </adfc-config>
    Method Code
    public String checkURL() {
    // Add event code here...
    System.out.println("method activity called");
    return "error";
    Best Regards,
    Ankit Gupta

Maybe you are looking for

  • Skip first screen

    hi all, i have a 'ztcode' with obligatory fields. i want to call 'ztcode' from another program using the following: call transaction 'ztcode' and skip first screen. is there a way to avoid error since obligatory fields will not be filled up if above

  • Have old video tapes; compact VHS. Have camera with S-video out

    Have compact VHS tape archive. Have camera with S-video out & good VHS player/adapter with S-Video out. Also have old PC with dedicated hardware capture card/cable and Pinnacle Studio. Am considering starting over with purchasing iMac for editing. I

  • 500-281 monitor connection

    Just bought an HP 500-281 and plan to connect it to a Dell UZ2315H multimedia monitor with speakers and webcam.  As I understand it, the 500-281 does not have an HDMI port, but instead an DVI-D or VGA port.  The monitor only has HDMI, VGA, USB 2.0, U

  • No sound for text or asterisk on home page.

    My girlfriend has a Q10 and when she receives a text the phone will not vibrate or make noise, the asterisk does not appear on top right corner of text icon on home page either? The text is there and she can reply but the small D that lets you know i

  • BM 3.9 audit log on different servers (and different databases)

    Hi after migrating from bm3.8 to bm3.9 we intalled Rule Hit Logging with naudit and mysql-database. we do have two bm3.9 servers connected with a WAN-Link. So we do want to keep the logs on the servers an do not want to log over the WAN-Link. We inst