Ejemplo n.º 1
0
 public void destroy() {
   if (fpp != null) {
     fpp.destroy();
     fpp.setVisible(false); // no more paints
   }
   printerJob = null;
 }
Ejemplo n.º 2
0
 public void showPage(int pageNumber) {
   try {
     fpp.showPage(pageNumber);
   } catch (Exception ex) {
     Debug.error(ex);
   }
 }
Ejemplo n.º 3
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
 }
Ejemplo n.º 4
0
  public void itemStateChanged(ItemEvent ie) {
    if (ie.getStateChange() == ItemEvent.SELECTED) {
      int idx = pages.getSelectedIndex();
      previous_page.setEnabled(idx != 0);
      next_page.setEnabled(idx < pages.getModel().getSize() - 1);

      if (ie.getSource() == pages) {
        showPage(idx);
      } else {
        // the comboBox editor also triggers an unnecessary ItemEvent(.SELECTED)
        if (zoom.getSelectedItem() instanceof String) return;
        ObjectWrapper tw = (ObjectWrapper) zoom.getSelectedItem();
        Float z = (Float) tw.getType();
        fpp.zoom(z.floatValue());

        if (getParent() != null) {
          invalidate();
          getParent().validate();
        }
      }
    }
    if (ie.getStateChange() == ItemEvent.DESELECTED) {
      int idx = pages.getSelectedIndex();
      previous_page.setEnabled(idx != 0);
      next_page.setEnabled(idx < pages.getModel().getSize() - 1);

      String zoomString = "";
      try {
        zoomString = (String) zoom.getEditor().getItem();
      } catch (ClassCastException e) {
        return;
      }
      if (zoomString.indexOf("%") == zoomString.length() - 1)
        zoomString = zoomString.substring(0, zoomString.length() - 1);
      float z = getValidZoom(zoomString);
      fpp.zoom(z);
      updateEditor(z);

      if (getParent() != null) {
        invalidate();
        getParent().validate();
      }
    }
  }
Ejemplo n.º 5
0
 public PrintPreview(
     ISmartClientApplication app,
     FormController formPanel,
     IFoundSetInternal fs,
     int zoomFactor,
     PrinterJob printerJob)
     throws Exception {
   this(app, formPanel, fs, printerJob);
   float z = getValidZoom(zoomFactor + "");
   fpp.zoom(z);
   updateEditor(z);
 }
Ejemplo n.º 6
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);
   }
 }