예제 #1
0
 /*
  * _____________________________________________________________ Declaration and definition of constructors
  */
 public CmdPageSetup(ISmartClientApplication app) {
   super(
       app,
       "CmdPageSetup",
       app.getI18NMessage("servoy.menuitem.pageSetup"),
       "servoy.menuitem.pageSetup",
       app.getI18NMessage("servoy.menuitem.pageSetup.mnemonic").charAt(0),
       app.loadImage("page_setup.gif")); // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
   // //$NON-NLS-5$
   setActionCommand("pagesetup"); // $NON-NLS-1$
   setEnabled(true);
 }
예제 #2
0
  public void showPages() {
    application
        .getScheduledExecutor()
        .execute(
            new Runnable() {
              public void run() {
                application.blockGUI(
                    application.getI18NMessage("servoy.print.status.generatePages")); // $NON-NLS-1$
                try {
                  int pageCount = fpp.process();
                  fillPageComboModel(pageCount);

                  application.invokeLater(
                      new Runnable() {
                        public void run() {
                          showPage(currentShowingPage); // show again in new Format
                        }
                      });
                } catch (Exception ex) {
                  application.reportError(
                      application.getI18NMessage("servoy.print.error.retrievingAllData"),
                      ex); //$NON-NLS-1$
                } finally {
                  application.releaseGUI();
                }
              }
            });
  }
예제 #3
0
 public CmdReCopyValues(ISmartClientApplication app) {
   super(
       app,
       "CmdReCopyValues",
       app.getI18NMessage("servoy.menuitem.relookup"),
       "servoy.menuitem.relookup"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 }
예제 #4
0
 // shows dialog if argument is null
 private void setPageFormat() // boolean showDialog)
     {
   try {
     PageFormat pf =
         CmdPageSetup.getPageFormat(
             fpp.getPageFormat(),
             application.getSettings(),
             application.getMainApplicationFrame());
     if (pf != null) {
       fpp.setPageFormat(pf);
     }
     showPages();
   } catch (Exception ex) {
     application.reportError(
         application.getI18NMessage("servoy.print.error.cannotCreatePreview"), ex); // $NON-NLS-1$
   }
   showPage(currentShowingPage); // show again in new Format
 }
예제 #5
0
 public void actionPerformed(ActionEvent ae) {
   String command = ae.getActionCommand();
   if (command.equals("print")) // $NON-NLS-1$
   {
     startPrinting(application, fpp.getPageable(), printerJob, preferredPrinterName, true, false);
   } else if (command.equals("pagesetup")) setPageFormat(); // true); //$NON-NLS-1$
   else if (command.equals("pageprevious")) show(-1); // $NON-NLS-1$
   else if (command.equals("pagenext")) show(+1); // $NON-NLS-1$
   else if (command.equals("close")) // $NON-NLS-1$
   {
     ICmdManager cm = application.getCmdManager();
     Action a = cm.getRegisteredAction("cmdbrowsemode"); // $NON-NLS-1$
     ICmd cmd = (ICmd) a;
     cmd.doIt(ae);
   }
 }
예제 #6
0
  public PrintPreview(
      ISmartClientApplication app,
      FormController formPanel,
      IFoundSetInternal fs,
      PrinterJob printerJob)
      throws Exception {
    application = app;
    application.getScriptEngine().getJSApplication().setDidLastPrintPreviewPrint(false);

    preferredPrinterName = formPanel.getPreferredPrinterName();
    this.printerJob = printerJob;
    setLayout(new BorderLayout());
    Toolbar buttonPane =
        new Toolbar(
            "print",
            application.getI18NMessage("servoy.toolbar.print.title"),
            false); //$NON-NLS-1$ //$NON-NLS-2$
    buttonPane.setFloatable(false);
    //        buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.X_AXIS));
    //        buttonPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
    //
    //        buttonPane.add(Box.createRigidArea(new
    // Dimension(J2DBClient.BUTTON_SPACING, 0)));
    buttonPane.addSeparator(new Dimension(J2DBClient.BUTTON_SPACING, 0));

    JButton print =
        new ToolbarButton(
            application.getI18NMessage("servoy.toolbar.print.button.print"),
            application.loadImage("print.gif")); // $NON-NLS-1$//$NON-NLS-2$
    print.setActionCommand("print"); // $NON-NLS-1$
    print.addActionListener(this);
    buttonPane.add(print);

    buttonPane.addSeparator(new Dimension(J2DBClient.BUTTON_SPACING, 0));
    //        buttonPane.add(Box.createRigidArea(new
    // Dimension(J2DBClient.BUTTON_SPACING, 0)));

    JButton pagesetup =
        new ToolbarButton(
            application.getI18NMessage("servoy.toolbar.print.button.pageSetup"),
            application.loadImage("page_setup.gif")); // $NON-NLS-1$//$NON-NLS-2$
    pagesetup.setActionCommand("pagesetup"); // $NON-NLS-1$
    pagesetup.addActionListener(this);
    buttonPane.add(pagesetup);
    //        buttonPane.add(Box.createRigidArea(new
    // Dimension(J2DBClient.BUTTON_SPACING, 0)));
    buttonPane.addSeparator(new Dimension(30, 0));

    //        buttonPane.add(new JLabel("Page: "));
    previous_page = new ToolbarButton(application.loadImage("page_previous.gif")); // $NON-NLS-1$
    //        previous_page.setPreferredSize(new Dimension(20,print.getHeight()));
    previous_page.setToolTipText(
        application.getI18NMessage("servoy.toolbar.print.button.prevPage.tooltip")); // $NON-NLS-1$
    previous_page.setActionCommand("pageprevious"); // $NON-NLS-1$
    previous_page.addActionListener(this);
    previous_page.setFocusPainted(false);
    buttonPane.add(previous_page);

    pages = new JComboBox();
    pages.setPreferredSize(new Dimension(70, ToolbarButton.PREF_HEIGHT));
    pages.setMaximumSize(new Dimension(70, ToolbarButton.PREF_HEIGHT));
    buttonPane.add(pages);

    next_page = new ToolbarButton(application.loadImage("page_next.gif")); // $NON-NLS-1$
    //        next_page.setPreferredSize(new Dimension(20,print.getHeight()));
    next_page.setToolTipText(
        application.getI18NMessage("servoy.toolbar.print.button.nextPage.tooltip")); // $NON-NLS-1$
    next_page.setActionCommand("pagenext"); // $NON-NLS-1$
    next_page.addActionListener(this);
    next_page.setFocusPainted(false);
    buttonPane.add(next_page);

    buttonPane.addSeparator(new Dimension(30, 0));
    //      buttonPane.add(Box.createRigidArea(new
    // Dimension(J2DBClient.BUTTON_SPACING, 0)));

    //        buttonPane.add(new JLabel("Zoom: "));

    zoom = new JComboBox();
    zoom.setEditable(true);
    zoom.setEditor(new BasicComboBoxEditor());
    zoom.setPreferredSize(new Dimension(100, ToolbarButton.PREF_HEIGHT));
    zoom.setMaximumSize(new Dimension(100, ToolbarButton.PREF_HEIGHT));
    zoom.addItem(
        new ObjectWrapper(
            application.getI18NMessage("servoy.print.zoom"),
            new Float(0.99f))); // to be enable //$NON-NLS-1$
    zoom.addItem(
        new ObjectWrapper(
            new Float(MIN_ZOOM_VALUE * 100.0f).intValue() + "%",
            new Float(MIN_ZOOM_VALUE))); // $NON-NLS-1$
    zoom.addItem(new ObjectWrapper("25%", new Float(0.25f))); // $NON-NLS-1$
    zoom.addItem(new ObjectWrapper("50%", new Float(0.5f))); // $NON-NLS-1$
    zoom.addItem(new ObjectWrapper("80%", new Float(0.8f))); // $NON-NLS-1$
    zoom.addItem(new ObjectWrapper("100%", new Float(1f))); // $NON-NLS-1$
    zoom.addItem(new ObjectWrapper("125%", new Float(1.25f))); // $NON-NLS-1$
    zoom.addItem(new ObjectWrapper("150%", new Float(1.5f))); // $NON-NLS-1$
    zoom.addItem(new ObjectWrapper("200%", new Float(2f))); // $NON-NLS-1$
    zoom.addItem(new ObjectWrapper("300%", new Float(3f))); // $NON-NLS-1$
    zoom.addItem(
        new ObjectWrapper(
            new Float(MAX_ZOOM_VALUE * 100.0f).intValue() + "%",
            new Float(MAX_ZOOM_VALUE))); // $NON-NLS-1$
    //        zoom.setSelectedIndex(3);
    zoom.addItemListener(this);
    buttonPane.add(zoom);

    buttonPane.addSeparator(new Dimension(J2DBClient.BUTTON_SPACING, 0));
    //      buttonPane.add(Box.createRigidArea(new
    // Dimension(J2DBClient.BUTTON_SPACING, 0)));

    JButton close =
        new ToolbarButton(application.getI18NMessage("servoy.button.close")); // $NON-NLS-1$
    close.setActionCommand("close"); // $NON-NLS-1$
    close.addActionListener(this);
    //        close.setPreferredSize(print.getPreferredSize());
    buttonPane.add(close);
    //        buttonPane.add(Box.createHorizontalGlue());
    //        buttonPane.setBorder(BorderFactory.createEtchedBorder());//
    // mptyBorder(10, 10, 10, 10));
    add(buttonPane, BorderLayout.NORTH);

    desk = new JPanel();
    desk.setBackground(new Color(141, 141, 141));
    desk.setBorder(BorderFactory.createEmptyBorder(25, 25, 25, 25));

    fpp = new FormPreviewPanel(application, formPanel, fs);
    desk.add(fpp, BorderLayout.CENTER);

    JScrollPane deskScroller = new ReleaseScrollPane(desk);
    add(deskScroller);

    currentShowingPage = 0;
  }