NSCREEN : create new NScreen model and change the code generation logic from new... 50/20150/2
authorparary <kyunghan80.park@samsung.com>
Mon, 28 Apr 2014 11:41:32 +0000 (20:41 +0900)
committerKyungHan Park <kyunghan80.park@samsung.com>
Mon, 28 Apr 2014 11:59:47 +0000 (04:59 -0700)
Change-Id: I7ac67e71369908e0f99e64e27a6f26a938da5cf1
Signed-off-by: parary <kyunghan80.park@samsung.com>
13 files changed:
org.tizen.webuibuilder/.gitignore
org.tizen.webuibuilder/res/xslt/page_managed_css_ver0_0_3.xslt
org.tizen.webuibuilder/src/org/tizen/webuibuilder/model/app/AppManagerForHTML.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/model/app/io/HtmlMetaReader_ver_1.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/model/app/io/HtmlMetaWriter_ver_1.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/model/css/CssFile.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/model/filedata/HtmlMetaFileData.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/model/filedata/PageFileData.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/model/io/file/PageReader_ver_2.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/model/io/file/PageWriter_ver_2.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/editor/PageDesignerForAppXML.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/editor/PageDesignerForHTML.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/newnscreen/NScreenModel.java

index a4dd084..a5664a9 100644 (file)
 /bin
 /bin
 /bin
+/bin
+/bin
+/bin
+/bin
+/bin
+/bin
+/bin
+/bin
+/bin
+/bin
+/bin
+/bin
+/bin
+/bin
+/bin
+/bin
+/bin
+/bin
+/bin
+/bin
+/bin
+/bin
+/bin
+/bin
+/bin
+/bin
+/bin
+/bin
+/bin
index 0530185..4d3cd4e 100644 (file)
@@ -1,31 +1,85 @@
 <?xml version="1.0" encoding="utf-8" ?>
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-<xsl:output method="text" encoding="utf-8" indent="yes"/>
+<xsl:stylesheet version="1.0"
+       xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+       <xsl:output method="text" encoding="utf-8" indent="yes" />
 
-<xsl:variable name="tab"><xsl:text>    </xsl:text></xsl:variable>
-<xsl:variable name="newline"><xsl:text>
-</xsl:text></xsl:variable>
+       <xsl:variable name="tab">
+               <xsl:text>    </xsl:text>
+       </xsl:variable>
+       <xsl:variable name="newline">
+               <xsl:text>
+</xsl:text>
+       </xsl:variable>
 
-<xsl:template match="/">
-    <xsl:text><![CDATA[/*******************************************************************************
+       <xsl:template match="/">
+               <xsl:text><![CDATA[/*******************************************************************************
 * This file was generated by Tizen Web UI Builder.
 * This file will be auto-generated each and everytime you save your project.
 * Do not hand edit this file.
 ********************************************************************************/
 ]]></xsl:text>
 
-<xsl:apply-templates select="/tizenFile/document/documentData/tizen.nscreen"/>
+               <xsl:apply-templates select="/tizenFile/document/documentData/tizen.nscreen" />
 
-</xsl:template>
+       </xsl:template>
 
-<xsl:template match="tizen.nscreen">
+       <xsl:template match="tizen.nscreen">
 
-    <xsl:for-each select="screen">
-               <xsl:sort select="width" order="descending" data-type="number"/>
-@import url("<xsl:value-of select="cssFileName"/>") screen and (max-width:<xsl:value-of select="width"/>px);
-    </xsl:for-each> 
+               <xsl:for-each select="screen">
+                       <xsl:sort select="width" order="descending" data-type="number" />
 
+                       <xsl:if test="@cssFileName = 'common.css'">
+@import url("<xsl:value-of select="@cssFileName" />") screen;
+                       </xsl:if>
 
-</xsl:template>
+                       <xsl:if test="@cssFileName != 'common.css'">
 
-</xsl:stylesheet>
+                               <xsl:variable name="cssFileName">
+                                       <xsl:value-of select="@cssFileName" />
+                               </xsl:variable>
+
+                               <xsl:variable name='device-width'>
+                                       <xsl:choose>
+                                               <xsl:when test='@device-width = null'>
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                       and (min-device-width:<xsl:value-of select="@min-device-width" />px) and (max-device-width:<xsl:value-of select="@device-width" />px)
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                               </xsl:variable>
+
+                               <xsl:variable name='color'>
+                                       <xsl:choose>
+                                               <xsl:when test='@color = null'></xsl:when>
+                                               <xsl:otherwise>
+                                                       and (max-color:<xsl:value-of select="@color" />)
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                               </xsl:variable>
+
+                               <xsl:variable name='color-index'>
+                                       <xsl:choose>
+                                               <xsl:when test='@color-index = null'></xsl:when>
+                                               <xsl:otherwise>
+                                                       and (color-index:<xsl:value-of select="@color-index" />)
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                               </xsl:variable>
+
+                               <xsl:variable name='grid'>
+                                       <xsl:choose>
+                                               <xsl:when test='@grid = null'></xsl:when>
+                                               <xsl:otherwise>
+                                                       and (grid)
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                               </xsl:variable>
+
+                               <xsl:for-each select="enablePage">
+                               # page name : <xsl:value-of select="."/>
+@import url ("<xsl:copy-of select="$cssFileName" />") screen<xsl:copy-of select="$device-width" /><xsl:copy-of select="$color" /><xsl:copy-of select="$color-index" /><xsl:copy-of select="$grid" />
+                               </xsl:for-each>
+                       </xsl:if>
+               </xsl:for-each>
+       </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file
index 2ac23e2..8f935b7 100644 (file)
@@ -59,7 +59,7 @@ import org.tizen.webuibuilder.model.page.PageDataForHTML;
 import org.tizen.webuibuilder.model.page.PageDataPaths;
 import org.tizen.webuibuilder.model.project.ProjectManager;
 import org.tizen.webuibuilder.ui.views.databinding.model.BindingData;
-import org.tizen.webuibuilder.ui.views.nscreen.model.NScreenModel;
+import org.tizen.webuibuilder.ui.views.newnscreen.NScreenModel;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
index f8d7c29..e4e5dba 100644 (file)
@@ -24,7 +24,6 @@
 package org.tizen.webuibuilder.model.app.io;
 
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 
 import org.w3c.dom.Attr;
@@ -42,7 +41,9 @@ import org.tizen.webuibuilder.model.filedata.HtmlMetaFileData;
 import org.tizen.webuibuilder.model.io.file.TizenFileFormatter;
 import org.tizen.webuibuilder.ui.views.databinding.model.BindingData;
 import org.tizen.webuibuilder.ui.views.databinding.model.BindingObject;
-import org.tizen.webuibuilder.ui.views.nscreen.model.NScreenModel;
+import org.tizen.webuibuilder.ui.views.newnscreen.NScreenModel;
+import org.tizen.webuibuilder.ui.views.newnscreen.NScreenModel.Orientation;
+import org.tizen.webuibuilder.ui.views.newnscreen.NScreenModel.Scan;
 
 
 public class HtmlMetaReader_ver_1 {
@@ -97,20 +98,8 @@ public class HtmlMetaReader_ver_1 {
     private static void parsePageData(HtmlMetaFileData fileData, Element elem,
                                       PartFactory partFactory) {
        NodeList elementList = elem.getElementsByTagName("tizen.nscreen");
-        for (int i = 0; i < elementList.getLength(); i++) {
-            Element nscreen = (Element) elementList.item(i);
-               NodeList elementList2 = nscreen.getElementsByTagName("screen");
-            for (int j = 0; j < elementList2.getLength(); j++) {
-                Element screen = (Element) elementList2.item(j);
-                NScreenModel model = new NScreenModel();
-
-                model.setTitle(screen.getAttribute("title"));
-                model.setWidth(Integer.parseInt(screen.getAttribute("width")));
-                model.setHeight(Integer.parseInt(screen.getAttribute("height")));
-                model.setFileName(screen.getAttribute("cssFileName"));
-
-                fileData.getNscreenModelList().add(model);
-            }
+        for ( int i = 0; i < elementList.getLength(); i++ ) {
+            parseNScreen( fileData, (Element) elementList.item( i ) );
         }
 
        elementList = elem.getElementsByTagName("pageData");
@@ -123,6 +112,61 @@ public class HtmlMetaReader_ver_1 {
                parseDataBinding(fileData, (Element) elementList.item(i));
         }
     }
+    
+    private static void parseNScreen( HtmlMetaFileData fileData, Element nscreen ) {
+        NodeList elementList2 = nscreen.getElementsByTagName( "screen" );
+        for ( int j = 0; j < elementList2.getLength(); j++ ) {
+            Element screen = (Element) elementList2.item( j );
+            NScreenModel model = new NScreenModel();
+
+            model.setTitle( screen.getAttribute( "title" ) );
+            model.setWidth( Integer.parseInt( screen.getAttribute( "device-width" ) ) );
+            model.setHeight( Integer.parseInt( screen.getAttribute( "device-height" ) ) );
+
+            if ( screen.getAttribute( "color" ).length() > 0 )
+                model.setColor( Integer.parseInt( screen.getAttribute( "color" ) ) );
+
+            if ( screen.getAttribute( "color-index" ).length() > 0 )
+                model.setColor( Integer.parseInt( screen.getAttribute( "color-index" ) ) );
+
+            if ( screen.getAttribute( "grid" ).length() > 0 && screen.getAttribute( "grid" ).equals( "true" ) )
+                model.setGrid( true );
+
+            if ( screen.getAttribute( "monochrome" ).length() > 0 )
+                model.setMonochrome( Integer.parseInt( screen.getAttribute( "monochrome" ) ) );
+
+            if ( screen.getAttribute( "orientation" ).length() > 0 ) {
+                if ( Orientation.LANDSCAPE.toString().toLowerCase().equals( screen.getAttribute( "orientation" ) ) )
+                    model.setOrientation( Orientation.LANDSCAPE );
+                else
+                    model.setOrientation( Orientation.PORTRAIT );
+            }
+
+            if ( screen.getAttribute( "resolution" ).length() > 0 )
+                model.setResolution( screen.getAttribute( "resolution" ) );
+
+            if ( screen.getAttribute( "scan" ).length() > 0 ) {
+                if ( Scan.PROGRESSIVE.toString().toLowerCase().equals( screen.getAttribute( "scan" ) ) )
+                    model.setScan( Scan.PROGRESSIVE );
+                else
+                    model.setScan( Scan.INTERLACE );
+            }
+            
+            if ( screen.getAttribute( "isLinked" ).length() > 0 && Boolean.parseBoolean( screen.getAttribute( "isLinked" ) ) )
+                model.setLink( screen.getAttribute( "cssFileName" ) );
+            else
+                model.setFileName( screen.getAttribute( "cssFileName" ) );
+            
+            NodeList nodeList = screen.getElementsByTagName( "enablePages" );
+            
+            for ( int i = 0; i < nodeList.getLength(); i++ ) {
+                Node enablePageNode = nodeList.item( i );
+                model.addEnablePage( enablePageNode.getTextContent() );
+            }
+
+            fileData.getNscreenModelList().add( model );
+        }
+    }
 
     private static void parseDataBinding(HtmlMetaFileData fileData, Element elem) {
         parseDataSource(fileData, elem);
index f53347b..15e3d3e 100644 (file)
@@ -45,6 +45,7 @@ import org.tizen.webuibuilder.model.io.file.TizenFileFormatter;
 import org.tizen.webuibuilder.model.page.PageData;
 import org.tizen.webuibuilder.ui.views.databinding.model.BindingData;
 import org.tizen.webuibuilder.ui.views.databinding.model.BindingObject;
+import org.tizen.webuibuilder.ui.views.newnscreen.NScreenModel;
 
 
 public class HtmlMetaWriter_ver_1 {
@@ -166,20 +167,62 @@ public class HtmlMetaWriter_ver_1 {
         });
 
         int preWidth = 0;
-        for (CssFile model : list) {
-            Element screenElement = doc.createElement("screen");
-            screenElement.setAttribute("title", model.getTitle());
-            screenElement.setAttribute("width", String.valueOf(model.getWidth()));
-            screenElement.setAttribute("height", String.valueOf(model.getHeight()));
-            screenElement.setAttribute("cssFileName", model.getFileName());
-            screenElement.setAttribute("minWidth", String.valueOf(preWidth));
-
-            preWidth = model.getWidth();
-            if (preWidth != 0) {
+        for ( CssFile file : list ) {
+            Element screenElement = doc.createElement( "screen" );
+
+            NScreenModel nsModel = file.getNScreenModel();
+
+            screenElement.setAttribute( "title", nsModel.getTitle() );
+
+            screenElement.setAttribute( "device-width", String.valueOf( nsModel.getDeviceWidth() ) );
+            screenElement.setAttribute( "device-height", String.valueOf( nsModel.getDeviceHeight() ) );
+
+            if ( nsModel.getDeviceWidth() != 0 & nsModel.getDeviceHeight() != 0 )
+                screenElement.setAttribute( "device-aspect-ratio", String.valueOf( nsModel.getDeviceAspectRatio() ) );
+
+            if ( nsModel.getColor() > 0 )
+                screenElement.setAttribute( "color", String.valueOf( nsModel.getColor() ) );
+
+            if ( nsModel.getColorIndex() > 0 )
+                screenElement.setAttribute( "color-index", String.valueOf( nsModel.getColorIndex() ) );
+
+            if ( nsModel.getGrid() )
+                screenElement.setAttribute( "grid", String.valueOf( true ) );
+
+            if ( nsModel.getMonochrome() > 0 )
+                screenElement.setAttribute( "monochrome", String.valueOf( nsModel.getMonochrome() ) );
+
+            if ( nsModel.getOrientation() != null )
+                screenElement.setAttribute( "orientation", nsModel.getOrientation().toString().toLowerCase() );
+
+            if ( nsModel.getOrientation() != null )
+                screenElement.setAttribute( "orientation", nsModel.getOrientation().toString()
+                        .toLowerCase() );
+
+            if ( nsModel.getResolution() != null )
+                screenElement.setAttribute( "resolution", nsModel.getResolution() );
+
+            if ( nsModel.getScan() != null )
+                screenElement.setAttribute( "scan", nsModel.getScan().toString().toLowerCase() );
+            
+            if ( nsModel.isLinked() )
+                screenElement.setAttribute( "isLinked", String.valueOf( true ) );
+            
+            for ( String enagePage : nsModel.getEnalbePages() ) {
+                Element enablePageElement = doc.createElement( "enablePage" );
+                enablePageElement.setTextContent( enagePage );
+                screenElement.appendChild( enablePageElement );
+            }
+
+            screenElement.setAttribute( "cssFileName", nsModel.getFileName() );
+            screenElement.setAttribute( "min-device-width", String.valueOf( preWidth ) );
+
+            preWidth = nsModel.getDeviceWidth();
+            if ( preWidth != 0 ) {
                 preWidth++;
             }
 
-            nscreenElement.appendChild(screenElement);
+            nscreenElement.appendChild( screenElement );
         }
         return nscreenElement;
     }
index 27d8f49..3b0fdd8 100644 (file)
@@ -29,7 +29,7 @@ import java.util.List;
 
 import org.eclipse.core.runtime.IPath;
 import org.tizen.webuibuilder.model.css.NewCssEvent.EventType;
-import org.tizen.webuibuilder.ui.views.nscreen.model.NScreenModel;
+import org.tizen.webuibuilder.ui.views.newnscreen.NScreenModel;
 
 
 /**
index c7f2d54..02f5b72 100644 (file)
@@ -28,7 +28,7 @@ import java.util.List;
 
 import org.tizen.webuibuilder.model.Part;
 import org.tizen.webuibuilder.ui.views.databinding.model.BindingData;
-import org.tizen.webuibuilder.ui.views.nscreen.model.NScreenModel;
+import org.tizen.webuibuilder.ui.views.newnscreen.NScreenModel;
 import org.w3c.dom.Document;
 
 
index 45d7618..9dcfade 100644 (file)
@@ -27,7 +27,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.tizen.webuibuilder.model.Part;
-import org.tizen.webuibuilder.ui.views.nscreen.model.NScreenModel;
+import org.tizen.webuibuilder.ui.views.newnscreen.NScreenModel;
 import org.w3c.dom.Document;
 
 
index b0f63e2..795572f 100644 (file)
@@ -25,16 +25,16 @@ package org.tizen.webuibuilder.model.io.file;
 
 import java.util.List;
 
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
 import org.tizen.webuibuilder.model.Part;
 import org.tizen.webuibuilder.model.PartFactory;
 import org.tizen.webuibuilder.model.css.CssSelector;
 import org.tizen.webuibuilder.model.filedata.PageFileData;
 import org.tizen.webuibuilder.model.io.ModelDeserializer;
-import org.tizen.webuibuilder.ui.views.nscreen.model.NScreenModel;
+import org.tizen.webuibuilder.ui.views.newnscreen.NScreenModel;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
 
 
 public class PageReader_ver_2 {
index cfa4942..d3ee6b4 100644 (file)
 package org.tizen.webuibuilder.model.io.file;
 
 import java.util.List;
-import java.util.Map.Entry;
 
-import org.tizen.webuibuilder.BuilderConstants;
-import org.tizen.webuibuilder.model.GotoPageProperty;
 import org.tizen.webuibuilder.model.Part;
-import org.tizen.webuibuilder.model.css.CssSelector;
-import org.tizen.webuibuilder.model.descriptors.PartDescriptor;
-import org.tizen.webuibuilder.model.descriptors.PropertyDescriptor;
-import org.tizen.webuibuilder.model.descriptors.TypeDescriptor;
 import org.tizen.webuibuilder.model.filedata.PageFileData;
 import org.tizen.webuibuilder.model.io.ModelSerializer;
-import org.tizen.webuibuilder.ui.views.nscreen.model.NScreenModel;
+import org.tizen.webuibuilder.ui.views.newnscreen.NScreenModel;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
index a108524..90f365e 100644 (file)
@@ -50,7 +50,7 @@ import org.tizen.webuibuilder.model.page.PageDataEvent;
 import org.tizen.webuibuilder.model.project.ProjectManager;
 import org.tizen.webuibuilder.ui.editor.texteditor.TextEditor;
 import org.tizen.webuibuilder.ui.editor.texteditor.TextEditorForAppXML;
-import org.tizen.webuibuilder.ui.views.nscreen.model.NScreenModel;
+import org.tizen.webuibuilder.ui.views.newnscreen.NScreenModel;
 
 
 public class PageDesignerForAppXML extends PageDesigner {
index 088c561..699f493 100644 (file)
@@ -56,7 +56,7 @@ import org.tizen.webuibuilder.ui.editor.texteditor.ITextEditorListener;
 import org.tizen.webuibuilder.ui.editor.texteditor.TextEditor;
 import org.tizen.webuibuilder.ui.editor.texteditor.TextEditorEvent;
 import org.tizen.webuibuilder.ui.editor.texteditor.TextEditorForHTML;
-import org.tizen.webuibuilder.ui.views.nscreen.model.NScreenModel;
+import org.tizen.webuibuilder.ui.views.newnscreen.NScreenModel;
 
 
 @SuppressWarnings("deprecation")
index 2216153..3c142bd 100644 (file)
@@ -23,6 +23,8 @@
 
 package org.tizen.webuibuilder.ui.views.newnscreen;
 
+import java.util.ArrayList;
+
 public class NScreenModel {
 
     public enum Orientation {
@@ -41,17 +43,17 @@ public class NScreenModel {
     private int colorIndex;
     private int deviceHeight;
     private int deviceWidth;
-    private Orientation orientation;
+    private Orientation orientation = null;
     private int monochrome;
     private String resolution;
-    private Scan scan;
-    private int grid;
+    private Scan scan = null;
+    private boolean grid = false;
+    private boolean isLink = false;
+    private ArrayList<String> enablePages = new ArrayList<String>();
 
     private String fileName;
 
-    NScreenModel link;
-
-    public NScreenModel(String title, int width, int height, String fileName) {
+    public NScreenModel( String title, int width, int height, String fileName ) {
         this.title = title;
         this.width = width;
         this.height = height;
@@ -59,14 +61,14 @@ public class NScreenModel {
     }
 
     public NScreenModel() {
-        this("Basic", 0, 0, "");
+        this( "Basic", 0, 0, "" );
     }
 
     public String getTitle() {
         return title;
     }
 
-    public void setTitle(String title) {
+    public void setTitle( String title ) {
         this.title = title;
     }
 
@@ -74,7 +76,7 @@ public class NScreenModel {
         return width;
     }
 
-    public void setWidth(int width) {
+    public void setWidth( int width ) {
         this.width = width;
     }
 
@@ -82,7 +84,7 @@ public class NScreenModel {
         return height;
     }
 
-    public void setHeight(int height) {
+    public void setHeight( int height ) {
         this.height = height;
     }
 
@@ -90,7 +92,7 @@ public class NScreenModel {
         return fileName;
     }
 
-    public void setFileName(String fileName) {
+    public void setFileName( String fileName ) {
         this.fileName = fileName;
     }
 
@@ -98,7 +100,7 @@ public class NScreenModel {
         return color;
     }
 
-    public void setColor(int color) {
+    public void setColor( int color ) {
         this.color = color;
     }
 
@@ -106,7 +108,7 @@ public class NScreenModel {
         return colorIndex;
     }
 
-    public void setColorIndex(int colorIndex) {
+    public void setColorIndex( int colorIndex ) {
         this.colorIndex = colorIndex;
     }
 
@@ -114,7 +116,7 @@ public class NScreenModel {
         return deviceHeight;
     }
 
-    public void setDeviceHeight(int deviceHeight) {
+    public void setDeviceHeight( int deviceHeight ) {
         this.deviceHeight = deviceHeight;
     }
 
@@ -122,7 +124,7 @@ public class NScreenModel {
         return deviceWidth;
     }
 
-    public void setDeviceWidth(int deviceWidth) {
+    public void setDeviceWidth( int deviceWidth ) {
         this.deviceWidth = deviceWidth;
     }
 
@@ -130,7 +132,7 @@ public class NScreenModel {
         return orientation;
     }
 
-    public void setOrientation(Orientation orientation) {
+    public void setOrientation( Orientation orientation ) {
         this.orientation = orientation;
     }
 
@@ -138,7 +140,7 @@ public class NScreenModel {
         return monochrome;
     }
 
-    public void setMonochrome(int monochrome) {
+    public void setMonochrome( int monochrome ) {
         this.monochrome = monochrome;
     }
 
@@ -146,7 +148,7 @@ public class NScreenModel {
         return resolution;
     }
 
-    public void setResolution(String resolution) {
+    public void setResolution( String resolution ) {
         this.resolution = resolution;
     }
 
@@ -154,15 +156,15 @@ public class NScreenModel {
         return scan;
     }
 
-    public void setScan(Scan scan) {
+    public void setScan( Scan scan ) {
         this.scan = scan;
     }
 
-    public int getGrid() {
+    public boolean getGrid() {
         return grid;
     }
 
-    public void setGrid(int grid) {
+    public void setGrid( boolean grid ) {
         this.grid = grid;
     }
 
@@ -171,46 +173,58 @@ public class NScreenModel {
     }
 
     public String getAspectRatio() {
-        return reduceRatio(width, height);
+        return reduceRatio( width, height );
     }
 
     public String getDeviceAspectRatio() {
-        return reduceRatio(deviceWidth, deviceHeight);
+        return reduceRatio( deviceWidth, deviceHeight );
+    }
+    
+    public void setLink( String fileName ){
+        this.fileName = fileName;
+        this.isLink = true;
+    }
+    
+    public boolean isLinked(){
+        return this.isLink;
+    }
+    
+    public ArrayList<String> getEnalbePages(){
+        return this.enablePages;
+    }
+    
+    public void addEnablePage( String enablePageID ){
+        this.enablePages.add( enablePageID );
+    }
+    
+    public boolean isEnablePage( String pageID ){
+        return this.enablePages.contains( pageID );
     }
 
-    public String reduceRatio(int numerator, int denominator) {
+    private String reduceRatio( int numerator, int denominator ) {
         int temp = 0;
 
-        if (numerator == denominator)
-            return "1:1";
+        if( numerator == 0 || denominator == 0)
+            return "0/0";
+        
+        if ( numerator == denominator )
+            return "1/1";
 
-        if (+numerator < +denominator) {
+        if ( +numerator < +denominator ) {
             temp = numerator;
             numerator = denominator;
             denominator = temp;
         }
 
-        int divisor = gcd(+numerator, +denominator);
+        int divisor = gcd( +numerator, +denominator );
 
-        return (numerator / divisor) + "/" + (denominator / divisor);
+        return ( numerator / divisor ) + "/" + ( denominator / divisor );
     }
 
-    private static int gcd(int a, int b) {
-        if (b == 0)
+    private static int gcd( int a, int b ) {
+        if ( b == 0 )
             return a;
 
-        return gcd(b, a % b);
-    }
-
-    public void linkTo(NScreenModel nScreenModel) {
-        link = nScreenModel;
-    }
-
-    public boolean isLink() {
-        if (link == null)
-            return false;
-        else
-            return true;
-
+        return gcd( b, a % b );
     }
 }