net.sf.latexdraw.mapping
Class Package2TextViewMapping

java.lang.Object
  extended by org.malai.mapping.Object2ObjectMapping<IUnary<java.lang.String>,IViewText>
      extended by net.sf.latexdraw.mapping.Package2TextViewMapping
All Implemented Interfaces:
IMapping

public class Package2TextViewMapping
extends Object2ObjectMapping<IUnary<java.lang.String>,IViewText>

This mapping maps the LaTeX packages, used for LaTeX compilation, with the text views. This kind of mapping is necessary to update the text views when the packages are modified.

This file is part of LaTeXDraw
Copyright (c) 2005-2012 Arnaud BLOUIN

LaTeXDraw is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

LaTeXDraw is distributed without any warranty; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

08/17/11

Version:
3.0
Author:
Arnaud BLOUIN

Field Summary
 
Fields inherited from class org.malai.mapping.Object2ObjectMapping
sourceObject, targetObject
 
Constructor Summary
Package2TextViewMapping(IUnary<java.lang.String> packages, IViewText textView)
          Creates the mapping.
 
Method Summary
 void onObjectModified(java.lang.Object object)
          Executes the mapping for the modification of an object.
 void onObjectReplaced(IUnary<?> object, java.lang.Object replacedObject)
          Executes the mapping when an object has been replaced by an other one.
private  void updateTarget()
          Updates the text view.
 
Methods inherited from class org.malai.mapping.Object2ObjectMapping
clear, getSource, getTarget, init, onListCleaned, onObjectAdded, onObjectMoved, onObjectRemoved
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Package2TextViewMapping

public Package2TextViewMapping(IUnary<java.lang.String> packages,
                               IViewText textView)
Creates the mapping.

Parameters:
packages - The LaTeX packages to listen.
textView - The text view to update.
Throws:
java.lang.IllegalArgumentException - If one of the given arguments is null or if they are the same object.
Since:
3.0
Method Detail

onObjectModified

public void onObjectModified(java.lang.Object object)
Description copied from interface: IMapping
Executes the mapping for the modification of an object.

Parameters:
object - The modified object.

onObjectReplaced

public void onObjectReplaced(IUnary<?> object,
                             java.lang.Object replacedObject)
Description copied from interface: IMapping
Executes the mapping when an object has been replaced by an other one.

Specified by:
onObjectReplaced in interface IMapping
Overrides:
onObjectReplaced in class Object2ObjectMapping<IUnary<java.lang.String>,IViewText>
Parameters:
object - The singleton that contains the new object.
replacedObject - The old object contained in the singleton that has been replaced.

updateTarget

private void updateTarget()
Updates the text view.