Package jsynoptic.ui

Examples of jsynoptic.ui.ShapesContainer$ShapesComponentDropListener


                ObjectInputStream is = new ObjectInputStream(fis);
                Object o = is.readObject();
                if ((o == null) || !(o instanceof ShapesContainer)) {
                    throw new java.io.IOException();
                }
                ShapesContainer sc = (ShapesContainer) o;
                String name = f.getName();
                String myExt = resources.getStringValue("jsynopticFilterExtension");
                if (name.endsWith(myExt)) {
                    name = name.substring(0, name.length() - myExt.length() - 1);
                }
                sc.getComponent().setName(name);
                // for ascending compatibility
                o = is.readObject();
                if ((o != null) && (o instanceof Vector)) {
                    for (Iterator it = ((Vector) o).iterator(); it.hasNext();) {
                        Object ito = it.next();
                        if (!(ito instanceof ColorMapper)) {
                            continue;
                        }
                        if (ColorMapper.colorMappers == null) {
                            ColorMapper.colorMappers = new Vector();
                        }
                        if (!ColorMapper.colorMappers.contains(ito)) {
                            ColorMapper.colorMappers.add(ito);
                        }
                    }
                }
                // for ascending compatibility
                o = is.readObject();
                if ((o != null) && (o instanceof Vector)) {
                    for (Iterator it = ((Vector) o).iterator(); it.hasNext();) {
                        Object ito = it.next();
                        if (!(ito instanceof TextMapper)) {
                            continue;
                        }
                        if (TextMapper.textMappers == null) {
                            TextMapper.textMappers = new Vector();
                        }
                        if (!TextMapper.textMappers.contains(ito)) {
                            TextMapper.textMappers.add(ito);
                        }
                    }
                }
                // for ascending compatibility
                o = is.readObject();
                if ((o != null) && (o instanceof Vector)) {
                    for (Iterator it = ((Vector) o).iterator(); it.hasNext();) {
                        Object ito = it.next();
                        if (!(ito instanceof ImageMapper)) {
                            continue;
                        }
                        if (ImageMapper.imageMappers == null) {
                            ImageMapper.imageMappers = new Vector();
                        }
                        if (!ImageMapper.imageMappers.contains(ito)) {
                            ImageMapper.imageMappers.add(ito);
                        }
                    }
                }
                is.close();
                fis.close(); // also closes the file
                for (Iterator it = sc.iterator(); it.hasNext();) {
                    try {
                        AbstractShape abs = (AbstractShape) it.next();
                        abs.addListener( (ShapeListener)sc.getComponent());
                        if (!(abs instanceof Linkable)) {
                            continue;
                        }
                        Linkable l = (Linkable) abs;
                        // Now trying to restore absolute file
                        File parent = f.getParentFile();
                        if (parent == null) {
                            parent = new File("./");
                        }
                        String link = l.getLink();
                        if ((link != null) && (!link.equals(""))) {
                            File nl = new File(parent, link);
                            l.setLink(nl.getCanonicalPath());
                        }
                    } catch (ClassCastException cce) {
                    }
                }
                if (JSynoptic.gui != null) {
                    JSynoptic.gui.addContainer(sc, f);
                }
                if (JSynopticBatch.batch != null) {
                    JSynopticBatch.batch.addContainer(sc, f);
                }
            } catch (Exception e) {
                if (JSynoptic.gui != null) {
                    JOptionPane.showMessageDialog(JSynoptic.gui.getOwner(), new JLabel(messageWriter.print1args(
                            "cannotLoadFile", f.getName())), messageWriter.print0args("loadedFileRemarks"),
                            JOptionPane.ERROR_MESSAGE);
                }
                e.printStackTrace();
                if (JSynopticBatch.batch != null) {
                    _logger.severe(messageWriter.print1args("cannotLoadFile", f.getName()));
                }
                JSynoptic.setStatus(messageWriter.print1args("cannotLoadFile", f.getName()));
                return false;
            }
            if (!DataSourcePool.global.localEmptySourcesIsEmpty()) {
                if (JSynoptic.gui != null) {
                    JOptionPane.showMessageDialog(JSynoptic.gui.getOwner(), new ReportingDialog(messageWriter
                            .print1args("missingElements", f.getName()), DataSourcePool.global
                            .getEmptySourcesDumpColumnNames(), DataSourcePool.global.getEmptySourcesDump()),
                            messageWriter.print0args("loadedFileRemarks"), JOptionPane.INFORMATION_MESSAGE);
                }
            }
            JSynoptic.setStatus(messageWriter.print1args("loadOK", f.getName()));
            return true;
        case SAVE:
            if (JSynoptic.gui == null) {
                return false;
            }
            JSynoptic.setStatus(messageWriter.print1args("saving", f.getName()));
            try {
                ShapesContainer sc = JSynoptic.gui.getActiveContainer();
                if (sc == null) {
                    return false;
                }
                // Save container into specified file
                saveShapeContainer(sc, f);
View Full Code Here


        if (templatePanel != null){
            templatePanel.getProperties();
        }
       
        // create the sheet
        ShapesContainer sc = new ShapesContainer(name);
       
        // Sheet dimensions - In case we are in Page Display Mode, we can get page dimension from DiagramComponent class
        // Otherwise, we consider the editor panel dimensions
        int height, width;
        if (DiagramComponent.isPrintViewEnabled()){
            height = DiagramComponent.getPageHeight();
            width = DiagramComponent.getPageWidth();
           
        } else {
            height = JSynoptic.gui.getFilePanel().getHeight() 46;        // 18 =  width taken by panel bordures
            width = JSynoptic.gui.getFilePanel().getWidth() - 18;       // 46 =  height taken by panel bordures   
        }
      
        sc.getComponent().setDiagramSize(width,height);
       
        // set the sheet
        setShapeContainer(sc);
       
        return sc;
View Full Code Here

   
   
    public static class EmptySheetTemplate extends Template {
  
        public ShapesContainer createShapeContainer(String name){
            return new ShapesContainer(name);
        }
View Full Code Here

TOP

Related Classes of jsynoptic.ui.ShapesContainer$ShapesComponentDropListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.