use of org.freeplane.features.text.TextController in project freeplane by freeplane.
the class FModeControllerFactory method createModeController.
public static FModeController createModeController() {
final Controller controller = Controller.getCurrentController();
modeController = new FModeController(controller);
final UserInputListenerFactory userInputListenerFactory = new UserInputListenerFactory(modeController);
modeController.setUserInputListenerFactory(userInputListenerFactory);
controller.addModeController(modeController);
controller.selectModeForBuild(modeController);
new FMapController(modeController);
UrlManager.install(new UrlManager());
MapIO.install(modeController);
new IconController(modeController).install(modeController);
NodeStyleController.install(new NodeStyleController(modeController));
EdgeController.install(new EdgeController(modeController));
new TextController(modeController).install(modeController);
LinkController.install(new LinkController(modeController));
CloudController.install(new CloudController(modeController));
ClipboardController.install(new ClipboardController());
LocationController.install(new LocationController());
LogicalStyleController.install(new LogicalStyleController(modeController));
MapStyle.install(true);
NodeStyleController.getController().addShapeGetter(new Integer(0), new IPropertyHandler<ShapeConfigurationModel, NodeModel>() {
public ShapeConfigurationModel getProperty(final NodeModel node, final ShapeConfigurationModel currentValue) {
return ShapeConfigurationModel.FORK;
}
});
modeController.addAction(new CenterAction());
modeController.addAction(new OpenPathAction());
userInputListenerFactory.setNodePopupMenu(new JPopupMenu());
final FreeplaneToolBar toolBar = new FreeplaneToolBar("main_toolbar", SwingConstants.HORIZONTAL);
FrameController frameController = (FrameController) controller.getViewController();
UIComponentVisibilityDispatcher.install(frameController, toolBar, "toolbarVisible");
userInputListenerFactory.addToolBar("/main_toolbar", ViewController.TOP, toolBar);
userInputListenerFactory.addToolBar("/filter_toolbar", FilterController.TOOLBAR_SIDE, FilterController.getCurrentFilterController().getFilterToolbar());
userInputListenerFactory.addToolBar("/status", ViewController.BOTTOM, controller.getViewController().getStatusBar());
NodeHistory.install(modeController);
return modeController;
}
use of org.freeplane.features.text.TextController in project freeplane by freeplane.
the class AttributeTableCellRenderer method getTableCellRendererComponent.
@Override
public Component getTableCellRendererComponent(final JTable table, final Object value, final boolean isSelected, final boolean hasFocus, final int row, final int column) {
final Component rendererComponent = super.getTableCellRendererComponent(table, value, hasFocus, isSelected, row, column);
final AttributeTable attributeTable = (AttributeTable) table;
zoom = attributeTable.getZoom();
final IAttributeTableModel attributeTableModel = (IAttributeTableModel) table.getModel();
final String originalText = value == null ? null : value.toString();
String text = originalText;
Icon icon;
if (column == 1 && value != null) {
try {
// evaluate values only
final TextController textController = TextController.getController();
Object transformedObject = textController.getTransformedObject(value, attributeTableModel.getNode(), null);
text = transformedObject.toString();
if (transformedObject instanceof HighlightedTransformedObject && TextController.isMarkTransformedTextSet()) {
setBorder(BorderFactory.createLineBorder(Color.GREEN));
}
} catch (Exception e) {
text = TextUtils.format("MainView.errorUpdateText", originalText, e.getLocalizedMessage());
setBorder(BorderFactory.createLineBorder(Color.RED));
}
if (value instanceof URI) {
icon = ((AttributeTable) table).getLinkIcon((URI) value);
} else {
icon = null;
}
} else {
icon = null;
}
final Icon scaledIcon;
final IconFactory iconFactory = IconFactory.getInstance();
if (icon != null && iconFactory.canScaleIcon(icon)) {
final int fontSize = getFont().getSize();
scaledIcon = iconFactory.getScaledIcon(icon, new Quantity<LengthUnits>(fontSize, LengthUnits.px));
} else
scaledIcon = icon;
if (scaledIcon != getIcon()) {
setIcon(scaledIcon);
}
setText(text);
if (text != originalText) {
final String toolTip = HtmlUtils.isHtmlNode(originalText) ? text : HtmlUtils.plainToHTML(originalText);
setToolTipText(toolTip);
} else {
final int prefWidth = getPreferredSize().width;
final int width = table.getColumnModel().getColumn(column).getWidth();
if (prefWidth > width) {
final String toolTip = HtmlUtils.isHtmlNode(text) ? text : HtmlUtils.plainToHTML(text);
setToolTipText(toolTip);
} else {
setToolTipText(null);
}
}
setOpaque(hasFocus);
return rendererComponent;
}
use of org.freeplane.features.text.TextController in project freeplane by freeplane.
the class DetailsViewMouseListener method mouseClicked.
@Override
public void mouseClicked(MouseEvent e) {
final ModeController mc = Controller.getCurrentController().getModeController();
if (Compat.isMacOsX()) {
final JPopupMenu popupmenu = mc.getUserInputListenerFactory().getNodePopupMenu();
if (popupmenu.isShowing()) {
return;
}
}
final NodeView nodeView = nodeSelector.getRelatedNodeView(e);
if (nodeView == null)
return;
final NodeModel model = nodeView.getModel();
TextController controller = TextController.getController();
if (eventFromHideDisplayArea(e)) {
final IMapSelection selection = Controller.getCurrentController().getSelection();
selection.keepNodePosition(model, 0.0f, 0.0f);
controller.setDetailsHidden(model, !DetailTextModel.getDetailText(model).isHidden());
} else {
nodeSelector.extendSelection(e);
if (canEdit(controller) && isEditingStartEvent(e)) {
final boolean editLong = e.isAltDown();
if (!editLong)
((MTextController) controller).getEventQueue().activate(e);
((MTextController) controller).editDetails(model, e, editLong);
} else
super.mouseClicked(e);
}
}
use of org.freeplane.features.text.TextController in project freeplane by freeplane.
the class AttributeCompareCondition method checkNode.
/*
* (non-Javadoc)
* @see
* freeplane.controller.filter.condition.Condition#checkNode(freeplane.modes
* .MindMapNode)
*/
public boolean checkNode(final NodeModel node) {
final IAttributeTableModel attributes = NodeAttributeTableModel.getModel(node);
final TextController textController = TextController.getController();
for (int i = 0; i < attributes.getRowCount(); i++) {
if (attribute.equals(AttributeConditionController.ANY_ATTRIBUTE_NAME_OR_VALUE_OBJECT)) {
if (checkContent(attributes.getValueAt(i, 0)))
return true;
} else if (!attributes.getValueAt(i, 0).equals(attribute)) {
continue;
}
final Object originalContent = attributes.getValueAt(i, 1);
final Object content = textController.getTransformedObjectNoFormattingNoThrow(originalContent, node, null);
if (checkContent(content))
return true;
}
return false;
}
use of org.freeplane.features.text.TextController in project freeplane by freeplane.
the class AttributeMatchesCondition method checkNode.
/*
* (non-Javadoc)
* @see
* freeplane.controller.filter.condition.Condition#checkNode(freeplane.modes
* .MindMapNode)
*/
public boolean checkNode(final NodeModel node) {
final IAttributeTableModel attributes = NodeAttributeTableModel.getModel(node);
final TextController textController = TextController.getController();
for (int i = 0; i < attributes.getRowCount(); i++) {
if (attribute.equals(AttributeConditionController.ANY_ATTRIBUTE_NAME_OR_VALUE_OBJECT)) {
if (checkText(attributes.getValueAt(i, 0).toString()))
return true;
} else if (!attributes.getValueAt(i, 0).equals(attribute)) {
continue;
}
final Object originalContent = attributes.getValueAt(i, 1);
String text = textController.getTransformedTextNoThrow(originalContent, node, null);
if (checkText(text))
return true;
}
return false;
}
Aggregations