Example usage for java.awt Dimension getWidth

List of usage examples for java.awt Dimension getWidth

Introduction

In this page you can find the example usage for java.awt Dimension getWidth.

Prototype

public double getWidth() 

Source Link

Usage

From source file:cool.pandora.modeller.ui.handlers.iiif.PatchResourceHandler.java

@Override
public void execute() {
    final String message = ApplicationContextUtil.getMessage("bag.message.resourcepatched");
    final DefaultBag bag = bagView.getBag();
    final List<String> payload = bag.getPayloadPaths();
    final Map<String, BagInfoField> map = bag.getInfo().getFieldMap();
    final URI resourceContainer = IIIFObjectURI.getResourceContainerURI(map);
    final String basePath = AbstractBagConstants.DATA_DIRECTORY;
    final Path rootDir = bagView.getBagRootPath().toPath();

    for (final String filePath : payload) {
        final String filename = BaggerFileEntity.removeBasePath(basePath, filePath);
        final String destinationURI = getDestinationURI(resourceContainer, filename);
        final Path absoluteFilePath = rootDir.resolve(filePath);
        final File resourceFile = absoluteFilePath.toFile();
        String formatName = null;
        Dimension dim = null;
        InputStream rdfBody = null;
        final URI uri = URI.create(destinationURI);
        try {/* w  w  w .  j av a2s .  c  o  m*/
            formatName = ImageIOUtil.getImageMIMEType(resourceFile);
        } catch (final Exception e) {
            e.printStackTrace();
        }

        try {
            dim = ImageIOUtil.getImageDimensions(resourceFile);
        } catch (final Exception e) {
            e.printStackTrace();
        }

        if (dim != null) {
            final double imgWidth = dim.getWidth();
            final int iw = (int) imgWidth;
            final double imgHeight = dim.getHeight();
            final int ih = (int) imgHeight;
            try {
                rdfBody = getResourceMetadata(map, filename, formatName, iw, ih);
            } catch (final Exception e) {
                e.printStackTrace();
            }
        }

        try {
            ModellerClient.doPatch(uri, rdfBody);
            ApplicationContextUtil.addConsoleMessage(message + " " + destinationURI);
        } catch (final ModellerClientFailedException e) {
            ApplicationContextUtil.addConsoleMessage(getMessage(e));
        }
    }
    bagView.getControl().invalidate();
}

From source file:org.photovault.swingui.PhotoViewController.java

/**
 * Sets up the window layout so that the collection is displayed as one vertical
 * column with preview image on right/*from   w ww  .java  2  s .c o m*/
 */
private void setupLayoutPreviewWithVerticalIcons() {
    // Minimum size is the size of one thumbnail
    int thumbColWidth = thumbPane.getColumnWidth();
    int thumbRowHeight = thumbPane.getRowHeight();
    scrollLayer.setMinimumSize(new Dimension(thumbColWidth + 20, thumbRowHeight));
    scrollLayer.setPreferredSize(new Dimension(thumbColWidth + 20, thumbRowHeight));
    thumbScroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    thumbScroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
    scrollLayer.setVisible(true);
    thumbPane.setColumnCount(1);
    previewPane.setVisible(true);
    layeredPane.removeAll();
    layeredPane.setVisible(false);
    splitPane.setVisible(true);
    splitPane.remove(previewPane);
    splitPane.remove(scrollLayer);
    splitPane.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
    splitPane.setLeftComponent(scrollLayer);
    splitPane.setRightComponent(previewPane);
    // Left component should not be resized 
    splitPane.setResizeWeight(0.0);
    Dimension minThumbDim = thumbPane.getMinimumSize();
    scrollLayer.setMinimumSize(new Dimension((int) minThumbDim.getWidth(), 0));
    previewPane.setMinimumSize(new Dimension(splitPane.getWidth() - 250 - splitPane.getInsets().left, 0));
    splitPane.validate();

    getView().validate();
}

From source file:ome.io.nio.PixelsService.java

private PixelsPyramidMinMaxStore performWrite(final Pixels pixels, final File pixelsPyramidFile,
        final BfPyramidPixelBuffer pixelsPyramid, final File pixelsFile, final String pixelsFilePath,
        final String originalFilePath) {

    final PixelBuffer source;
    final Dimension tileSize;
    final PixelsPyramidMinMaxStore minMaxStore;

    if (pixelsFile.exists()) {
        minMaxStore = null;/*  ww  w  . jav  a  2s.com*/
        source = createRomioPixelBuffer(pixelsFilePath, pixels, false);
        // FIXME: This should be configuration or service driven
        // FIXME: Also implemented in RenderingBean.getTileSize()
        tileSize = new Dimension(Math.min(pixels.getSizeX(), sizes.getTileWidth()),
                Math.min(pixels.getSizeY(), sizes.getTileHeight()));
    } else {
        minMaxStore = new PixelsPyramidMinMaxStore(pixels.getSizeC());
        int series = getSeries(pixels);
        BfPixelBuffer bfPixelBuffer = createMinMaxBfPixelBuffer(originalFilePath, series, minMaxStore);
        pixelsPyramid
                .setByteOrder(bfPixelBuffer.isLittleEndian() ? ByteOrder.LITTLE_ENDIAN : ByteOrder.BIG_ENDIAN);
        source = bfPixelBuffer;
        // If the tile sizes we've been given are completely ridiculous
        // then reset them to WIDTHxHEIGHT. Currently these conditions are:
        //  * TileWidth == ImageWidth
        //  * TileHeight == ImageHeight
        //  * Smallest tile dimension divided by the largest resolution
        //    level factor is < 1.
        // -- Chris Allan (ome:#5224).
        final Dimension sourceTileSize = source.getTileSize();
        final double tileWidth = sourceTileSize.getWidth();
        final double tileHeight = sourceTileSize.getHeight();
        final boolean tileDimensionTooSmall;
        double factor = Math.pow(2, 5);
        if (((tileWidth / factor) < 1.0) || ((tileHeight / factor) < 1.0)) {
            tileDimensionTooSmall = true;
        } else {
            tileDimensionTooSmall = false;
        }
        if (tileWidth == source.getSizeX() || tileHeight == source.getSizeY() || tileDimensionTooSmall) {
            tileSize = new Dimension(Math.min(pixels.getSizeX(), sizes.getTileWidth()),
                    Math.min(pixels.getSizeY(), sizes.getTileHeight()));
        } else {
            tileSize = sourceTileSize;
        }
    }
    log.info("Destination pyramid tile size: " + tileSize);

    try {
        final double totalTiles = source.getSizeZ() * source.getSizeC() * source.getSizeT()
                * (Math.ceil(source.getSizeX() / tileSize.getWidth()))
                * (Math.ceil(source.getSizeY() / tileSize.getHeight()));
        final int tenPercent = Math.max((int) totalTiles / 10, 1);
        Utils.forEachTile(new TileLoopIteration() {
            public void run(int z, int c, int t, int x, int y, int w, int h, int tileCount) {
                if (log.isInfoEnabled() && tileCount % tenPercent == 0) {
                    log.info(String.format("Pyramid creation for Pixels:%d %d/%d (%d%%).", pixels.getId(),
                            tileCount + 1, (int) totalTiles, (int) (tileCount / totalTiles * 100)));
                }
                try {
                    PixelData tile = source.getTile(z, c, t, x, y, w, h);
                    pixelsPyramid.setTile(tile.getData().array(), z, c, t, x, y, w, h);
                } catch (IOException e1) {
                    log.error("FAIL -- Error during tile population", e1);
                    try {
                        pixelsPyramidFile.delete();
                        FileUtils.touch(pixelsPyramidFile); // ticket:5189
                    } catch (Exception e2) {
                        log.warn("Error clearing empty or incomplete pixel " + "buffer.", e2);
                    }
                    return;
                }
            }
        }, source, (int) tileSize.getWidth(), (int) tileSize.getHeight());

        log.info("SUCCESS -- Pyramid created for pixels id:" + pixels.getId());

    }

    finally {
        if (source != null) {
            try {
                source.close();
            } catch (IOException e) {
                log.error("Error closing pixel pyramid.", e);
            }
        }
    }
    return minMaxStore;
}

From source file:com.hp.autonomy.frontend.reports.powerpoint.PowerPointServiceImpl.java

/**
 * Convert provided anchor points from fractional units (0-1 range) to PowerPoint coordinates.
 * @param ppt the PowerPoint presentation to use.
 * @param anchor the anchor in fractional (0-1) units.
 * @return bounding rectangle in PowerPoint coordinates.
 *//* w w w  .j  a va  2 s.c o  m*/
private static Rectangle2D.Double createPageAnchor(final XMLSlideShow ppt, final Anchor anchor) {
    final Dimension pageSize = ppt.getPageSize();
    final double availW = pageSize.getWidth();
    final double availH = pageSize.getHeight();

    return new Rectangle2D.Double(availW * anchor.getX(), availH * anchor.getY(), availW * anchor.getWidth(),
            availH * anchor.getHeight());
}

From source file:inet.CalculationNetworkEditor.visual.view.EditorPane.java

public EditorPane(List<Graph<V, E>> phys, List<Graph<V, E>> virts, HashMap<V, V> stackVertex,
        HashMap<E, List<E>> stackEdge, HashMap<V, Double> vertexRessources, HashMap<E, Double> edgeRessources,
        Factory<V> pVertexFactory, Factory<E> pEdgeFactory, Dimension pActDimension) {
    super();/*from  w  w w.j ava 2 s .c  om*/
    actDimension = pActDimension;

    Dimension tabbedDimensions = new Dimension((int) pActDimension.getWidth() - 200,
            (int) pActDimension.getHeight());

    setSize(pActDimension);
    setPreferredSize(pActDimension);
    setLayout(new BorderLayout());

    vertexFactory = pVertexFactory;
    edgeFactory = pEdgeFactory;

    logic = new Logic<V, E>();
    logic.init(phys, virts, stackVertex, stackEdge, vertexRessources, edgeRessources);

    tabbedPane = new JTabbedPane();
    tabbedPane.setSize(tabbedDimensions);
    tabbedPane.setPreferredSize(tabbedDimensions);
    add(tabbedPane, BorderLayout.CENTER);

    rightBetweenPanel = new JPanel();
    rightBetweenPanel.setLayout(new BorderLayout());
    rightBetweenPanel.setSize(200, 500);
    rightBetweenPanel.setPreferredSize(new Dimension(200, 500));
    add(rightBetweenPanel, BorderLayout.LINE_END);

    rightPanel = new JPanel();
    rightPanel.setSize(200, 500);
    rightPanel.setPreferredSize(new Dimension(200, 500));
    rightBetweenPanel.add(rightPanel, BorderLayout.CENTER);

    vertexPaintTransformer = new VertexPaintTransformer<V, E>(logic, tabbedPane);
    vertexPaintTransformerStacking = new VertexPaintTransformerStacking<V, E>(logic, tabbedPane);
    edgePaintTransformer = new EdgePaintTransformer<V, E>(logic, tabbedPane);
    edgeStrokeTransformer = new EdgeStrokeTransformer<V, E>(logic, tabbedPane);

    // init VisualisationViewer
    visViewPhysical = new VisualizationViewerPhysical<V, E>(logic.getDisplay(IStorage.Type.PHYSICAL),
            vertexPaintTransformer, edgePaintTransformer, edgeStrokeTransformer, this);

    visViewVirtual = new VisualizationViewerVirtual<V, E>(logic.getDisplay(IStorage.Type.VIRTUAL),
            vertexPaintTransformer, edgePaintTransformer, edgeStrokeTransformer, this);

    visViewBoth = new VisualizationViewerBoth<V, E>(logic.getDisplay(null), vertexPaintTransformer,
            vertexPaintTransformerStacking, edgePaintTransformer, edgeStrokeTransformer, this);

    vc = new ViewController<V, E>(this, visViewPhysical, visViewVirtual, visViewBoth);
    bc = new BackendController<V, E>(logic, pVertexFactory, pEdgeFactory);

    mouseAbstraction = new MouseAbstraction<V, E>(vc, bc, this);
    editingPanelsListener = new EditingPanelsListener<V, E>(this, bc);

    visViewPhysical.setMouseAbstraction(mouseAbstraction);
    visViewVirtual.setMouseAbstraction(mouseAbstraction);
    visViewBoth.setMouseAbstraction(mouseAbstraction);

    /*
    visViewPhysical.setGraphMouse(mgm);
    visViewVirtual.setGraphMouse(mgm);
    visViewBoth.setGraphMouse(mgm);
    */

    vertexPaintTransformer.setVisualizationViewers(visViewPhysical, visViewVirtual, visViewBoth);
    vertexPaintTransformerStacking.setVisualizationViewers(visViewPhysical, visViewVirtual, visViewBoth);
    edgePaintTransformer.setVisualizationViewers(visViewPhysical, visViewVirtual, visViewBoth);

    /*
    deprecatedMML = new Controller(
                layoutPhysical, layoutVirtual, layoutBoth,
                visViewPhysical, visViewVirtual, visViewBoth,
                tabbedPane, logic, physGraph, virtGraph,
                vertexFactory, edgeFactory); //,
    //                mousePhysical, mouseVirtual, mouseBoth);
    */

    //visViewStateChangedListener = new VisualViewerStateChangedListener(visViewPhysical, visViewVirtual, visViewBoth);
    tabSwitchListener = new TabSwitchedListener(this, tabbedPane);//,deprecatedMML);

    reinitializeTabPane();

    addComponentListener(new ComponentResizedListener(tabbedPane, this));
    add(tabbedPane, BorderLayout.CENTER);
    //add(vv);
}

From source file:io.bibleget.BibleGetHelp.java

/**
 * Creates new form BibleGetHelp// w  ww . ja va 2  s . co  m
 */
private BibleGetHelp() throws ClassNotFoundException, UnsupportedEncodingException {
    //jTextPane does not initialize correctly, it causes a Null Exception Pointer
    //Following line keeps this from crashing the program
    Thread.currentThread().setContextClassLoader(getClass().getClassLoader());

    String packagePath = BibleGetIO.getPackagePath();
    //String locale = BibleGetIO.getLocale();

    String langsSupported;
    List<String> langsLocalized = new ArrayList<>();
    String bbBooks;

    bibleGetDB = BibleGetDB.getInstance();
    if (bibleGetDB != null) {
        //System.out.println("oh good, biblegetDB is not null!");
        JsonReader jsonReader;
        langsSupported = bibleGetDB.getMetaData("LANGUAGES");
        //System.out.println(langsSupported);
        jsonReader = Json.createReader(new StringReader(langsSupported));
        bibleVersionsObj = jsonReader.readArray();
        booksLangs = bibleVersionsObj.size();
        for (JsonValue jsonValue : bibleVersionsObj) {
            //System.out.println(jsonValue.toString());
            langsLocalized.add(BibleGetI18N.localizeLanguage(jsonValue.toString()));
        }
        booksStr = StringUtils.join(langsLocalized, ", ");

        List<JsonArray> bibleBooksTemp = new ArrayList<>();
        for (int i = 0; i < 73; i++) {
            bbBooks = bibleGetDB.getMetaData("BIBLEBOOKS" + Integer.toString(i));
            jsonReader = Json.createReader(new StringReader(bbBooks));
            JsonArray bibleBooksObj = jsonReader.readArray();
            bibleBooksTemp.add(bibleBooksObj);
        }

        String curLang;
        List<String[]> booksForCurLang;
        //bibleBooks = new HashMap<>();
        booksAndAbbreviations = new HashMap<>();
        String buildStr;
        for (int q = 0; q < bibleVersionsObj.size(); q++) {
            curLang = (bibleVersionsObj.getString(q) != null)
                    ? BibleGetI18N.localizeLanguage(bibleVersionsObj.getString(q)).toUpperCase()
                    : "";
            buildStr = "";
            for (int i = 0; i < 73; i++) {

                String styleStr = "";
                if (bibleVersionsObj.getString(q).equals("TAMIL")
                        || bibleVersionsObj.getString(q).equals("KOREAN")) {
                    styleStr = " style=\"font-family:'Arial Unicode MS';\"";
                }

                JsonArray curBook = bibleBooksTemp.get(i);
                JsonArray curBookCurLang = curBook.getJsonArray(q);
                String str1 = (curBookCurLang.getString(0) != null) ? curBookCurLang.getString(0) : "";
                String str2 = (curBookCurLang.getString(1) != null) ? curBookCurLang.getString(1) : "";
                buildStr += "<tr><td" + styleStr + ">" + str1 + "</td><td" + styleStr + ">" + str2
                        + "</td></tr>";
                //buildStr += "<tr><td style=\"font-family:'Arial Unicode MS';\">"+str1+"</td><td style=\"font-family:'Arial Unicode MS';\">"+str2+"</td></tr>";
            }
            booksAndAbbreviations.put(curLang, buildStr);
        }

    } else {
        booksLangs = 0;
        booksStr = "";
    }
    kit = new HTMLEditorKit();
    doc = kit.createDefaultDocument();
    styles = kit.getStyleSheet();
    styles.addRule("body { background-color: #FFFFDD; border: 2px inset #CC9900; }");
    styles.addRule("h1 { color: #0000AA; }");
    styles.addRule("h2 { color: #0000AA; }");
    styles.addRule("h3 { color: #0000AA; }");
    styles.addRule("p { text-align: justify; }");
    styles.addRule("table { border-collapse: collapse; width: 600px; margin-left: auto; }");
    styles.addRule(
            "th { text-align: center; border: 4px ridge #DEB887; background-color: #F5F5DC; padding: 3px; }");
    styles.addRule(
            "td { text-align: justify; border: 3px ridge #DEB887; background-color: #F5F5DC; padding: 3px; }");

    //System.out.println("We have package path in BibleGetHelp! It is: "+packagePath);

    HTMLStr0 = "<html><head><meta charset=\"utf-8\"></head><body>" + "<h1>"
            + __("Help for BibleGet (Open Office Writer)") + "</h1>" + "<p>"
            + __("This Help dialog window introduces the user to the usage of the BibleGet I/O plugin for Open Office Writer.")
            + "</p>" + "<p>" + __("The Help is divided into three sections:") + "</p>" + "<ul>" + "<li>"
            + __("Usage of the Plugin") + "</li>" + "<li>" + __("Formulation of the Queries") + "</li>" + "<li>"
            + __("Biblical Books and Abbreviations") + "</li>" + "</ul>" + "<p><b>" + __("AUTHOR") + ":</b> "
            + __("John R. D'Orazio (chaplain at Roma Tre University)") + "</p>" + "<p><b>" + __("COLLABORATORS")
            + ":</b> " + __("Giovanni Gregori (computing) and Simone Urbinati (MUG Roma Tre)") + "</p>"
            + "<p><b>" + __("Version").toUpperCase() + ":</b> " + String.valueOf(BibleGetIO.VERSION) + "</p>"
            + "<p> <b>Copyright 2014 BibleGet I/O by John R. D'Orazio</b> <span style=\"color:blue;\">john.dorazio@cappellaniauniroma3.org</span></p>"
            + "<p><b>" + __("PROJECT WEBSITE")
            + ": </b><span style=\"color:blue;\">http://www.bibleget.io</span> | <b>"
            + __("EMAIL ADDRESS FOR INFORMATION OR FEEDBACK ON THE PROJECT")
            + ":</b> <span style=\"color:blue;\">bibleget.io@gmail.com</span></p>"
            + "<p>Cappellania Universit degli Studi Roma Tre - Piazzale San Paolo 1/d - 00120 Citt del Vaticano - +39 06.69.88.08.09 - <span style=\"color:blue;\">cappellania.uniroma3@gmail.com</span></p></body></html>";

    String strfmt1 = __("Insert quote from input window");
    String strfmt2 = __("About this plugin");
    String strfmt3 = __("RENEW SERVER DATA");
    String strfmt4 = strfmt1;
    String strfmt5 = __("Insert quote from text selection");
    String strfmt6 = strfmt1;

    HTMLStr1 = "<html><head><meta charset=\"utf-8\"></head><body>" + "<h2>" + __("How to use the plugin")
            + "</h2>" + "<h3>" + __("Description of the menu icons and their functionality.") + "</h3>" + "<p>"
            + __("Once the extension is installed, a new menu 'BibleGet I/O' will appear on the menu bar. Also a new floating toolbar will appear. The buttons on the floating toolbar correspond to the menu items in the new menu, as can be seen in this image:")
            + "</p><br /><br />" + "<img src=\"" + packagePath + "/images/Screenshot.jpg\" /><br /><br />"
            + "<p>"
            + __("The floating toolbar can be dragged and placed anywhere on the screen. It can also be docked to certain areas of the workspace, for example on the toolbar below the menu bar, like in this image:")
            + "</p><br /><br />" + "<img src=\"" + packagePath + "/images/Screenshot2.jpg\" /><br /><br />"
            + "<p>" + __("There are two ways of inserting a bible quote into a document.") + " "
            + __("The first way is by using the input window.") + " "
            + MessageFormat.format(__(
                    "If you click on the menu item ''{0}'', an input window will open where you can input your query and choose the version or versions you would like to take the quote from."),
                    strfmt1)
            + " "
            + __("This list of versions is updated from the available versions on the BibleGet server, but since the information is stored locally it may be necessary to renew the server information when new versions are added to the BibleGet server database.")
            + " "
            + MessageFormat.format(__(
                    "In order to renew the information from the BibleGet server, click on the ''{0}'' menu item, and then click on the button ''{1}''."),
                    strfmt2, strfmt3)
            + " "
            + MessageFormat.format(__(
                    "When you choose a version or multiple versions to quote from, this choice is automatically saved as a preference, and will be pre-selected the next time you open the ''{0}'' menu item."),
                    strfmt4)
            + "<br /><br />" + "<img src=\"" + packagePath + "/images/Screenshot4.jpg\" /><br /><br />"
            + MessageFormat.format(__(
                    "The second way is by writing your desired quote directly in the document, and then selecting it and choosing the menu item ''{0}''. The selected text will be substituted by the Bible Quote retrieved from the BibleGet server."),
                    strfmt5)
            + " "
            + MessageFormat.format(__(
                    "The versions previously selected in the ''{0}'' window will be used, so you must have selected your preferred versions at least once from the ''{0}'' window."),
                    strfmt6)
            + "</p><br /><br />" + "<img src=\"" + packagePath + "/images/Screenshot3.jpg\" /><br /><br />"
            + "<p>"
            + __("Formatting preferences can be set using the 'Preferences' window. You can choose the desired font for the Bible quotes as well as the desired line-spacing, and you can choose separate formatting (font size, font color, font style) for the book / chapter, for the verse numbers, and for the verse text. Preferences are saved automatically.")
            + "</p><br /><br />" + "<img src=\"" + packagePath + "/images/Screenshot5.jpg\" /><br /><br />"
            + "<p>"
            + __("After the 'Help' menu item that opens up this same help window, the last three menu items are:")
            + "</p>" + "<ul>" + "<li><img src=\"" + packagePath + "/images/email.png\" />" + " '"
            + __("Send feedback") + "': <span>"
            + __("This will open up your system's default email application with the bibleget.io@gmail.com feedback address already filled in.")
            + "</span></li>" + "<li><img src=\"" + packagePath + "/images/paypal.png\" />" + " '"
            + __("Contribute") + "': <span>"
            + __("This will open a Paypal page in the system's default browser where you can make a donation to contribute to the project. Even just 1 can help to cover the expenses of this project. Just the server costs 120 a year.")
            + "</span></li>" + "<li><img src=\"" + packagePath + "/images/info.png\" />" + " '"
            + __("Information on the BibleGet I/O Project") + "': <span>"
            + __("This opens a dialog window with some information on the project and it's plugins, on the author and contributors, and on the current locally stored information about the versions and languages that the BibleGet server supports.")
            + "</span></li>" + "</ul>" + "</body></html>";

    String strfmt7 = __("Biblical Books and Abbreviations");

    HTMLStr2 = "<html>" + "<head><meta charset=\"utf-8\"></head>" + "<body>" + "<h2>"
            + __("How to formulate a bible query") + "</h2>" + "<p>"
            + __("The queries for bible quotes must be formulated using standard notation for bible citation.")
            + " "
            + __("This can be either the english notation (as explained here: https://en.wikipedia.org/wiki/Bible_citation), or the european notation as explained here below. ")
            + "</p>" + "<p>"
            + __("A basic query consists of at least two elements: the bible book and the chapter.") + " "
            + __("The bible book can be written out in full, or in an abbreviated form.") + " "
            + MessageFormat.format(__(
                    "The BibleGet engine recognizes the names of the books of the bible in {0} different languages: {1}"),
                    Integer.toString(booksLangs), booksStr)
            + " "
            + MessageFormat.format(__("See the list of valid books and abbreviations in the section {0}."),
                    "<span class=\"internal-link\" id=\"to-bookabbrevs\">" + strfmt7 + "</span>")
            + " "
            + __("For example, the query \"Matthew 1\" means the book of Matthew (or better the gospel according to Matthew) at chapter 1.")
            + " " + __("This can also be written as \"Mt 1\".") + "</p>" + "<p>"
            + __("Different combinations of books, chapters, and verses can be formed using the comma delimiter and the dot delimiter (in european notation, in english notation instead a colon is used instead of a comma and a comma is used instead of a dot):")
            + "</p>" + "<ul>" + "<li>"
            + __("\",\": the comma is the chapter-verse delimiter. \"Matthew 1,5\" means the book (gospel) of Matthew, chapter 1, verse 5. (In English notation: \"Matthew 1:5\".)")
            + "</li>" + "<li>"
            + __("\".\": the dot is a delimiter between verses. \"Matthew 1,5.7\" means the book (gospel) of Matthew, chapter 1, verses 5 and 7. (In English notation: \"Matthew 1:5,7\".)")
            + "</li>" + "<li>"
            + __("\"-\": the dash is a range delimiter, which can be used in a variety of ways:") + "<ol>"
            + "<li>"
            + __("For a range of chapters: \"Matthew 1-2\" means the gospel according to Matthew, from chapter 1 to chapter 2.")
            + "</li>" + "<li>"
            + __("For a range of verses within the same chapter: \"Matthew 1,1-5\" means the gospel according to Matthew, chapter 1, from verse 1 to verse 5. (In English notation: \"Matthew 1:1-5\".)")
            + "</li>" + "<li>"
            + __("For a range of verses that span over different chapters: \"Matthew 1,5-2,13\" means the gospel according to Matthew, from chapter 1, verse 5 to chapter 2, verse 13. (In English notation: \"Matthew 1:5-2:13\".)")
            + "</li>" + "</ol>" + "</ul>" + "<p>"
            + __("Different combinations of these delimiters can form fairly complex queries, for example \"Mt1,1-3.5.7-9\" means the gospel according to Matthew, chapter 1, verses 1 to 3, verse 5, and verses 7 to 9. (In English notation: \"Mt1:1-3,5,7-9\".)")
            + "</p>" + "<p>" + __("Multiple queries can be combined together using a semi-colon \";\".") + " "
            + __("If the query following the semi-colon refers to the same book as the preceding query, it is not necessary to indicate the book a second time.")
            + " "
            + __("For example, \"Matthew 1,1;2,13\" means the gospel according to Matthew, chapter 1 verse 1 and chapter 2 verse 13. (In English notation: \"Matthew 1:1;2:13\".)")
            + " "
            + __("Here is an example of multiple complex queries combined into a single querystring: \"Genesis 1,3-5.7.9-11.13;2,4-9.11-13;Apocalypse 3,10.12-14\". (In English notation: \"Genesis 1:3-5,7,9-11,13;2:4-9,11-13;Apocalypse 3:10,12-14\").")
            + "</p>" + "<p>"
            + __("It doesn't matter whether or not you use a space between the book and the chapter, the querystring will be interpreted just the same.")
            + __("It is also indifferent whether you use uppercase or lowercase letters, the querystring will be interpreted just the same.")
            + "</p>" + "</body>" + "</html>";

    HTMLStr3 = "<html>" + "<head><meta charset=\"utf-8\"></head>" + "<body>" + "<h2>"
            + __("Biblical Books and Abbreviations") + "</h2>" + "<p>"
            + __("Here is a list of valid books and their corresponding abbreviations, either of which can be used in the querystrings.")
            + " "
            + __("The abbreviations do not always correspond with those proposed by the various editions of the Bible, because they would conflict with those proposed by other editions.")
            + " "
            + __("For example some english editions propose \"Gn\" as an abbreviation for \"Genesis\", while some italian editions propose \"Gn\" as an abbreviation for \"Giona\" (= \"Jonah\").")
            + " "
            + __("Therefore you will not always be able to use the abbreviations proposed by any single edition of the Bible, you must use the abbreviations that are recognized by the BibleGet engine as listed in the following table:")
            + "</p><br /><br />" + "<table cellspacing='0'>" + "<caption>{1}</caption>"
            + "<tr><th style=\"width:70%;\">" + __("BOOK") + "</th><th style=\"width:30%;\">"
            + __("ABBREVIATION") + "</th></tr>" + "{0}" + "</table>" + "</body>" + "</html>";

    Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
    screenWidth = (int) screenSize.getWidth();
    screenHeight = (int) screenSize.getHeight();
    frameWidth = 1250;
    frameHeight = 700;
    frameLeft = (screenWidth / 2) - (frameWidth / 2);
    frameTop = (screenHeight / 2) - (frameHeight / 2);
    initComponents();
}

From source file:ireport_5_6_0.view.JasperViewer.java

/** This method is called from within the constructor to
 * initialize the form./*from  ww  w  .ja v a 2  s .  com*/
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the Form Editor.
 */
private void initComponents() {//GEN-BEGIN:initComponents
    pnlMain = new javax.swing.JPanel();

    setTitle("JasperViewer");
    setIconImage(
            new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/jricon.GIF"))
                    .getImage());
    addWindowListener(new java.awt.event.WindowAdapter() {
        @Override
        public void windowClosing(java.awt.event.WindowEvent evt) {
            exitForm();
        }
    });

    pnlMain.setLayout(new java.awt.BorderLayout());

    getContentPane().add(pnlMain, java.awt.BorderLayout.CENTER);

    pack();

    Toolkit toolkit = java.awt.Toolkit.getDefaultToolkit();
    java.awt.Dimension screenSize = toolkit.getScreenSize();
    int screenResolution = toolkit.getScreenResolution();
    float zoom = ((float) screenResolution) / JRViewer.REPORT_RESOLUTION;

    int height = (int) (550 * zoom);
    if (height > screenSize.getHeight()) {
        height = (int) screenSize.getHeight();
    }
    int width = (int) (750 * zoom);
    if (width > screenSize.getWidth()) {
        width = (int) screenSize.getWidth();
    }

    java.awt.Dimension dimension = new java.awt.Dimension(width, height);
    setSize(dimension);
    setLocation((screenSize.width - width) / 2, (screenSize.height - height) / 2);
}

From source file:ome.services.RawPixelsBean.java

@RolesAllowed("user")
public int[] getTileSize() {
    errorIfNotLoaded();// www. j  a v a 2s  .c  o  m
    Dimension tileSize = buffer.getTileSize();
    return new int[] { (int) tileSize.getWidth(), (int) tileSize.getHeight() };
}

From source file:org.zaproxy.zap.extension.callgraph.CallGraphFrame.java

/**
 * sets up the graph by retrieving the nodes and edges from the history table in the database
 *
 * @param urlPattern/*from w w  w .j av a2s.  co  m*/
 * @throws SQLException
 */
private void setupGraph(Pattern urlPattern) throws SQLException {
    Connection conn = null;
    Statement st = null;
    ResultSet rs = null;
    Map<String, String> schemaAuthorityToColor = new HashMap<String, String>();
    // use some web safe colours. Currently, there are 24 colours.
    String[] colors = { "#FFFF00", "#FFCC00", "#FF9900", "#FF6600", "#FF3300", "#CCFF00", "#CCCC00", "#CC9900",
            "#CC6600", "#99FF00", "#999900", "#996600", "#CCFFCC", "#CCCCCC", "#99CCCC", "#9999CC", "#9966CC",
            "#66FFCC", "#6699CC", "#6666CC", "#33FFCC", "#33CCCC", "#3399CC", "#00FFCC" };
    int colorsUsed = 0;
    try {
        // Create a pattern for the specified

        // get a new connection to the database to query it, since the existing database classes
        // do not cater for
        // ad-hoc queries on the table
        /*
         * TODO Add-ons should NOT make their own connections to the db any more - the db layer is plugable
         * so could be implemented in a completely different way
         * TODO: how? There is currently no API to do this.
         */
        // Note: the db is a singleton instance, so do *not* close it!!
        Database db = Model.getSingleton().getDb();
        if (!(db instanceof ParosDatabase)) {
            throw new InvalidParameterException(db.getClass().getCanonicalName());
        }

        conn = ((ParosDatabaseServer) db.getDatabaseServer()).getNewConnection();

        // we begin adding stuff to the graph, so begin a "transaction" on it.
        // we will close this after we add all the vertexes and edges to the graph
        graph.getModel().beginUpdate();

        // prepare to add the vertices to the graph
        // this must include all URLs references as vertices, even if those URLs did not feature
        // in the history table in their own right

        // include entries of type 1 (proxied), 2 (spidered), 10 (Ajax spidered) from the
        // history
        st = conn.createStatement();
        rs = st.executeQuery(
                "select distinct URI from HISTORY where histtype in (1,2,10) union distinct select distinct  RIGHT(REGEXP_SUBSTRING (REQHEADER, 'Referer:.+') , LENGTH(REGEXP_SUBSTRING (REQHEADER, 'Referer:.+'))-LENGTH('Referer: ')) from HISTORY where REQHEADER like '%Referer%' and histtype in (1,2,10) order by 1");
        for (; rs.next();) {
            String url = rs.getString(1);

            // remove urls that do not match the pattern specified (all sites / one site)
            Matcher urlmatcher = urlPattern.matcher(url);
            if (urlmatcher.find()) {
                // addVertex(url , url);
                try {
                    URI uri = new URI(url, false);
                    String schemaAuthority = uri.getScheme() + "://" + uri.getAuthority();
                    String path = uri.getPathQuery();
                    if (path == null)
                        path = "/";
                    String color = schemaAuthorityToColor.get(schemaAuthority);
                    if (color == null) {
                        // not found already.. so assign this scheme and authority a color.
                        if (colorsUsed >= colors.length) {
                            throw new Exception("Too many scheme/authority combinations. Ne need more colours");
                        }
                        color = colors[colorsUsed++];
                        schemaAuthorityToColor.put(schemaAuthority, color);
                    }
                    addVertex(path, url, "fillColor=" + color);
                } catch (Exception e) {
                    log.error("Error graphing node for URL " + url, e);
                }
            } else {
                if (log.isDebugEnabled())
                    log.debug("URL " + url + " does not match the specified pattern " + urlPattern
                            + ", so not adding it as a vertex");
            }
        }
        // close the resultset and statement
        rs.close();
        st.close();

        // set up the edges in the graph
        st = conn.createStatement();
        rs = st.executeQuery(
                "select distinct RIGHT(REGEXP_SUBSTRING (REQHEADER, 'Referer:.+') , LENGTH(REGEXP_SUBSTRING (REQHEADER, 'Referer:.+'))-LENGTH('Referer: ')), URI from HISTORY where REQHEADER like '%Referer%' and histtype in (1,2,10) order by 2");

        mxGraphModel graphmodel = (mxGraphModel) graph.getModel();
        for (; rs.next();) {
            String predecessor = rs.getString(1);
            String url = rs.getString(2);

            // now trim back all urls from the base url
            // Matcher predecessorurlmatcher = urlpattern.matcher(predecessor);
            // if (predecessorurlmatcher.find()) {
            //   predecessor =  predecessorurlmatcher.group(1);
            //   }
            // Matcher urlmatcher = urlpattern.matcher(url);
            // if (urlmatcher.find()) {
            //   url =  urlmatcher.group(1);
            //   }

            // remove urls that do not match the pattern specified (all sites / one site)
            Matcher urlmatcher1 = urlPattern.matcher(predecessor);
            if (!urlmatcher1.find()) {
                if (log.isDebugEnabled())
                    log.debug("Predecessor URL " + predecessor + " does not match the specified pattern "
                            + urlPattern + ", so not adding it as a vertex");
                continue; // to the next iteration
            }
            Matcher urlmatcher2 = urlPattern.matcher(url);
            if (!urlmatcher2.find()) {
                if (log.isDebugEnabled())
                    log.debug("URL " + url + " does not match the specified pattern " + urlPattern
                            + ", so not adding it as a vertex");
                continue; // to the next iteration
            }

            // check that we have added the url as a vertex in its own right.. definitely should
            // have happened..
            mxCell predecessorVertex = (mxCell) graphmodel.getCell(predecessor);
            mxCell postdecessorVertex = (mxCell) graphmodel.getCell(url);
            if (predecessorVertex == null || postdecessorVertex == null) {
                log.warn("Could not find graph node for " + predecessor + " or for " + url + ". Ignoring it.");
                continue;
            }
            // add the edge (ie, add the dependency between 2 URLs)
            graph.insertEdge(parent, predecessorVertex.getId() + "-->" + postdecessorVertex.getId(), null,
                    predecessorVertex, postdecessorVertex);
        }

        // once all the vertices and edges are drawn, look for root nodes (nodes with no
        // incoming edges)
        // we will display the full URl for these, rather than just the path, to aid viewing the
        // graph
        Object[] vertices = graph.getChildVertices(graph.getDefaultParent());
        for (Object vertex : vertices) {
            Object[] incomingEdgesForVertex = graph.getIncomingEdges(vertex);
            if (incomingEdgesForVertex == null
                    || (incomingEdgesForVertex != null && incomingEdgesForVertex.length == 0)) {
                // it's a root node. Set it's value (displayed label) to the same as it's id
                // (the full URL)
                mxCell vertextCasted = (mxCell) vertex;
                vertextCasted.setValue(vertextCasted.getId());

                // now sort out the text metrics for the vertex, since the size of the displayed
                // text has been changed
                Dimension textsize = this.getTextDimension((String) vertextCasted.getValue(), this.fontmetrics);
                mxGeometry cellGeometry = vertextCasted.getGeometry();
                cellGeometry.setHeight(textsize.getHeight());
                cellGeometry.setWidth(textsize.getWidth());
                vertextCasted.setGeometry(cellGeometry);
            }
        }
    } catch (SQLException e) {
        log.error("Error trying to setup the graph", e);
        throw e;
    } finally {

        if (rs != null && !rs.isClosed())
            rs.close();
        if (st != null && !st.isClosed())
            st.close();
        if (conn != null && !conn.isClosed())
            conn.close();
        // mark the "transaction" on the graph as complete
        graph.getModel().endUpdate();
    }
}

From source file:co.com.soinsoftware.hotelero.view.JFRoomService.java

public JFRoomService() {
    this.invoiceController = new InvoiceController();
    this.serviceController = new ServiceController();
    invoiceItemController = new InvoiceItemController();
    serviceTypeController = new ServiceTypeController();
    this.initComponents();
    final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    this.setLocation((int) (screenSize.getWidth() / 2 - 350), (int) (screenSize.getHeight() / 2 - 350));
    this.setModal(true);
}