コード例 #1
0
ファイル: ExportMapAction.java プロジェクト: afifun/abstools
 private void generateMapFile(
     Diagram diagram, TextHandler textHandler, String mapName, File target) throws IOException {
   String encoding = ConfigurationManager.getGlobalConfiguration().getFileEncoding();
   FileOutputStream fos = new FileOutputStream(target);
   OutputStreamWriter osw = new OutputStreamWriter(fos, encoding);
   PrintWriter pw = new PrintWriter(osw);
   pw.println("<!-- Generated by Quick Sequence Diagram Editor -->");
   pw.println("<!-- encoding: " + encoding + " -->");
   pw.println(
       "<!-- You may append '#!href=\"<url>\"' to an object declaration\nin order to set"
           + " the 'href' attribute of an AREA tag -->");
   pw.println("<map id=\"" + mapName + "\" name=\"" + mapName + "\">");
   for (Lifeline lifeline : diagram.getAllLifelines()) {
     String annotation = textHandler.getAnnotation(lifeline);
     String file = lifeline.getName();
     if (annotation != null) {
       String href[] = Grep.parse("^.*?href=\"(.*?)\".*$", annotation);
       if (href != null) {
         file = href[0];
       }
     }
     Drawable drawable = lifeline.getHead();
     int x1 = drawable.getLeft();
     int y1 = drawable.getTop();
     int x2 = drawable.getRight();
     int y2 = drawable.getBottom();
     String coords = x1 + "," + y1 + "," + x2 + "," + y2;
     pw.println("  <area shape=\"rect\" coords=\"" + coords + "\"" + " href=\"" + file + "\"/>");
   }
   pw.println("</map>");
   pw.flush();
   pw.close();
 }
コード例 #2
0
 static {
   String laf = ConfigurationManager.getGlobalConfiguration().getLookAndFeel();
   LookAndFeelManager.instance().changeTo(laf);
   if (OS.TYPE != OS.Type.WINDOWS) {
     GrabbableViewport.setHandCursorIcon(Icons.getIcon("grabbing"));
   }
 }
コード例 #3
0
 public void setCode(String text) {
   Tab tab = currentTab();
   if (tab != null) {
     tab.setCode(text);
     tab.home();
   }
   enableComponents();
   if (!ConfigurationManager.getGlobalConfiguration().isAutoUpdate()) {
     fireCodeChanged(false);
   }
 }
コード例 #4
0
 public String addTab(String tabTitle, Bean<Configuration> configuration) {
   Tab tab =
       new Tab(
           this,
           redrawThread,
           ConfigurationManager.getGlobalConfiguration().getEditorFont(),
           configuration);
   for (UserInterfaceListener listener : listeners) {
     if (listener.getPanelPaintDeviceListener() != null) {
       tab.addPanelPaintDeviceListener(listener.getPanelPaintDeviceListener());
     }
   }
   String uniqueTitle = tabbedPane.addTab(tab, tabTitle);
   currentTab().layout(configuration.getDataObject().isVerticallySplit() ? 1 : 0);
   enableComponents();
   return uniqueTitle;
 }
コード例 #5
0
  public UserInterfaceImpl() {
    super();
    LookAndFeelManager.instance()
        .setFont(ConfigurationManager.getGlobalConfiguration().getGuiFont());
    setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    enableComponents = new EnableComponents();

    preferencesDialog = new ConfigurationDialog(this);
    preferencesDialog.setTitle("Preferences");
    preferencesDialog.getContentPane().setLayout(new BorderLayout());
    preferencesDialog.setModal(true);
    preferencesDialog.setSize(new Dimension(675, 475));
    LookAndFeelManager.instance().register(preferencesDialog);

    configurationPane = new JTabbedPane();
    preferencesDialog.getContentPane().add(configurationPane, BorderLayout.CENTER);
    globalConfigurationUI =
        new ConfigurationUI<GlobalConfiguration>(
            preferencesDialog,
            ConfigurationManager.getGlobalConfigurationBean(),
            ConfigurationManager.GLOBAL_DEFAULT,
            null,
            "Restore defaults|Changes the current global preferences so that they are equal to the default preferences",
            "<html>In this tab you can change global preferences. On exit, they are stored in the"
                + " file <tt>"
                + Constants.GLOBAL_CONF_FILE.getAbsolutePath()
                + "</tt>.");
    globalConfigurationUI.setBorder(BorderFactory.createEmptyBorder(15, 15, 0, 15));
    preferencesDialog.addConfigurationUI(globalConfigurationUI);

    ConfigurationUI<Configuration> defaultCUI =
        new ConfigurationUI<Configuration>(
            preferencesDialog,
            ConfigurationManager.getDefaultConfigurationBean(),
            ConfigurationManager.LOCAL_DEFAULT,
            null,
            "Restore defaults|Changes the initial preferences (to be used for newly created diagrams) such that they are equal to the default settings",
            "<html>This tab is for adjusting the (initial) preferences that are used for"
                + " newly created diagrams. They are stored along with the global preferences.");
    defaultCUI.setBorder(BorderFactory.createEmptyBorder(15, 15, 0, 15));
    preferencesDialog.addConfigurationUI(defaultCUI);

    localConfigurationUI =
        new ConfigurationUI<Configuration>(
            preferencesDialog,
            ConfigurationManager.createNewDefaultConfiguration(),
            ConfigurationManager.getDefaultConfigurationBean(),
            "Save as initial|Saves the current diagram's preferences as the initial preferences (to be used for all newly created diagrams)",
            "Restore initial|Changes the current diagram's preferences such that they are equal to the initial preferences",
            "<html>This tab is for changing the preferences for the diagram"
                + " currently being displayed.<br>They will be stored "
                + " when the diagram is saved as an <tt>.sdx</tt>-file.");
    localConfigurationUI.setBorder(BorderFactory.createEmptyBorder(15, 15, 0, 15));

    for (JPanel panel : localConfigurationUI.getCategoryPanels()) {
      LookAndFeelManager.instance().registerOrphan(panel);
    }

    preferencesDialog.addConfigurationUI(localConfigurationUI);

    configurationPane.add("Global preferences", globalConfigurationUI);
    configurationPane.add("Initial diagram preferences", defaultCUI);
    configurationPane.addTab("Current diagram preferences", localConfigurationUI);

    for (JPanel panel : globalConfigurationUI.getCategoryPanels()) {
      LookAndFeelManager.instance().registerOrphan(panel);
    }
    for (JPanel panel : defaultCUI.getCategoryPanels()) {
      LookAndFeelManager.instance().registerOrphan(panel);
    }

    listeners = new LinkedList<UserInterfaceListener>();
    redrawThread = new RedrawThread(this);
    redrawThread.start();
    menuBar = new MenuBar();
    toolbar = new JToolBar();
    toolbar.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    toolbar.setFloatable(false);
  }