All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jpedal.examples.viewer.commands.ContinuousFacing Maven / Gradle / Ivy

There is a newer version: 7.15.25
Show newest version
/*
 * ===========================================
 * Java Pdf Extraction Decoding Access Library
 * ===========================================
 *
 * Project Info:  http://www.idrsolutions.com
 * Help section for developers at http://www.idrsolutions.com/support/
 *
 * (C) Copyright 1997-2017 IDRsolutions and Contributors.
 *
 * This file is part of JPedal/JPDF2HTML5
 *
 @LICENSE@
 *
 * ---------------
 * ContinuousFacing.java
 * ---------------
 */
package org.jpedal.examples.viewer.commands;

import java.awt.Component;

import org.jpedal.PdfDecoderInt;
import org.jpedal.display.Display;
import org.jpedal.examples.viewer.Commands;
import org.jpedal.examples.viewer.SharedViewer;
import org.jpedal.examples.viewer.Values;
import org.jpedal.examples.viewer.gui.GUI;
import org.jpedal.gui.GUIFactory;

/**
 * Change page display mode to continuous facing
 */
public class ContinuousFacing {

    public static void execute(final Object[] args, final PdfDecoderInt decode_pdf, final GUIFactory currentGUI, final Values commonValues) {
        if (!decode_pdf.isOpen() || decode_pdf.getDisplayView() == Display.CONTINUOUS_FACING) {
            return;
        }

        if (args == null) {

            currentGUI.getCombo(Commands.SCALING).setEnabled(true);
            currentGUI.getCombo(Commands.ROTATION).setEnabled(true);

            currentGUI.getButtons().getButton(Commands.ROTATELEFT).setEnabled(true);
            currentGUI.getButtons().getButton(Commands.ROTATERIGHT).setEnabled(true);

            if (currentGUI.getGlassPane() != null) {
                ((Component) currentGUI.getGlassPane()).setVisible(true);
            }

            currentGUI.getButtons().getButton(Commands.MOUSEMODE).setEnabled(true);
            currentGUI.getButtons().getButton(Commands.SNAPSHOT).setEnabled(true);

            //Fit to page
            //Set combo ID to -1 to avoid the actionListener being called which would change the position
            currentGUI.getCombo(Commands.SCALING).setID(-1);
            ((GUI) currentGUI).setSelectedComboIndex(Commands.SCALING, 0);
            currentGUI.getCombo(Commands.SCALING).setID(Commands.SCALING);
            currentGUI.scaleAndRotate();

            currentGUI.getButtons().alignLayoutMenuOption(Display.CONTINUOUS_FACING);

            if (SharedViewer.isFX()) {
                ModeChange.changeModeInJavaFX(Display.CONTINUOUS_FACING, decode_pdf, currentGUI);
            } else {
                ModeChange.changeModeInSwing(Display.CONTINUOUS_FACING, decode_pdf, currentGUI, commonValues);
            }
            currentGUI.updateTextBoxSize();

        }

    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy