Пример #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 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;
  }