/* (non-Javadoc) * @see freemind.modes.MindMapEdge#getStyleAsInt() */ public int getStyleAsInt() { final String edgeStyle = getStyle(); if (Tools.safeEquals(edgeStyle, EDGESTYLE_LINEAR)) { return INT_EDGESTYLE_LINEAR; } else if (Tools.safeEquals(edgeStyle, EDGESTYLE_BEZIER)) { return INT_EDGESTYLE_BEZIER; } else if (Tools.safeEquals(edgeStyle, EDGESTYLE_SHARP_LINEAR)) { return INT_EDGESTYLE_SHARP_LINEAR; } else if (Tools.safeEquals(edgeStyle, EDGESTYLE_SHARP_BEZIER)) { return INT_EDGESTYLE_SHARP_BEZIER; } else { throw new IllegalArgumentException("Unknown Edge Style " + edgeStyle); } }
private boolean acquirePrinterJobAndPageFormat() { if (printerJob == null) { try { printerJob = PrinterJob.getPrinterJob(); } catch (SecurityException ex) { isPrintingAllowed = false; return false; } } if (pageFormat == null) { pageFormat = printerJob.defaultPage(); if (Tools.safeEquals(getProperty("page_orientation"), "landscape")) { pageFormat.setOrientation(PageFormat.LANDSCAPE); } else if (Tools.safeEquals(getProperty("page_orientation"), "portrait")) { pageFormat.setOrientation(PageFormat.PORTRAIT); } else if (Tools.safeEquals(getProperty("page_orientation"), "reverse_landscape")) { pageFormat.setOrientation(PageFormat.REVERSE_LANDSCAPE); } } return true; }
public void act(XmlAction action) { if (action instanceof FontNodeAction) { FontNodeAction fontFamilyAction = (FontNodeAction) action; MindMapNode node = getNodeFromID(fontFamilyAction.getNode()); String fontFamily = fontFamilyAction.getFont(); if (!Tools.safeEquals(node.getFontFamilyName(), fontFamily)) { ((NodeAdapter) node).establishOwnFont(); node.setFont( modeController .getController() .getFontThroughMap( new Font(fontFamily, node.getFont().getStyle(), node.getFont().getSize()))); modeController.nodeChanged(node); } } }
public static void replace( IReplaceInputInformation info, String searchString, String replaceString) { String regExp = "(" + (searchString) + ")"; Pattern p = Pattern.compile(regExp, Pattern.CASE_INSENSITIVE); // String replacement = getPureRegularExpression(replaceString); String replacement = (replaceString); int length = info.getLength(); for (int i = 0; i < length; i++) { NodeHolder nodeHolder = info.getNodeHolderAt(i); String text = nodeHolder.node.getText(); String replaceResult = HtmlTools.getInstance().getReplaceResult(p, replacement, text); if (!Tools.safeEquals(text, replaceResult)) { // set new node text only, if different. info.changeString(nodeHolder, replaceResult); } } }
public void actionPerformed(ActionEvent e) { if (!acquirePrinterJobAndPageFormat()) { return; } // Ask about custom printing settings final JDialog dialog = new JDialog( (JFrame) getFrame(), getResourceString("printing_settings"), /* modal= */ true); final JCheckBox fitToPage = new JCheckBox( getResourceString("fit_to_page"), Tools.safeEquals("true", getProperty("fit_to_page"))); final JLabel userZoomL = new JLabel(getResourceString("user_zoom")); final JTextField userZoom = new JTextField(getProperty("user_zoom"), 3); userZoom.setEditable(!fitToPage.isSelected()); final JButton okButton = new JButton(getResourceString("ok")); final Tools.IntHolder eventSource = new Tools.IntHolder(); JPanel panel = new JPanel(); GridBagLayout gridbag = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); eventSource.setValue(0); okButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { eventSource.setValue(1); dialog.dispose(); } }); fitToPage.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent e) { userZoom.setEditable(e.getStateChange() == ItemEvent.DESELECTED); } }); // c.weightx = 0.5; c.gridx = 0; c.gridy = 0; c.gridwidth = 2; gridbag.setConstraints(fitToPage, c); panel.add(fitToPage); c.gridy = 1; c.gridwidth = 1; gridbag.setConstraints(userZoomL, c); panel.add(userZoomL); c.gridx = 1; c.gridwidth = 1; gridbag.setConstraints(userZoom, c); panel.add(userZoom); c.gridy = 2; c.gridx = 0; c.gridwidth = 3; c.insets = new Insets(10, 0, 0, 0); gridbag.setConstraints(okButton, c); panel.add(okButton); panel.setLayout(gridbag); dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); dialog.setContentPane(panel); dialog.setLocationRelativeTo((JFrame) getFrame()); dialog.getRootPane().setDefaultButton(okButton); dialog.pack(); // calculate the size dialog.show(); if (eventSource.getValue() == 1) { setProperty("user_zoom", userZoom.getText()); setProperty("fit_to_page", fitToPage.isSelected() ? "true" : "false"); } else return; // Ask user for page format (e.g., portrait/landscape) pageFormat = printerJob.pageDialog(pageFormat); if (pageFormat.getOrientation() == PageFormat.LANDSCAPE) { setProperty("page_orientation", "landscape"); } else if (pageFormat.getOrientation() == PageFormat.PORTRAIT) { setProperty("page_orientation", "portrait"); } else if (pageFormat.getOrientation() == PageFormat.REVERSE_LANDSCAPE) { setProperty("page_orientation", "reverse_landscape"); } }