/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
<?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
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;
package org.tizen.webuibuilder.model.app.io;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import org.w3c.dom.Attr;
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 {
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");
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);
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 {
});
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;
}
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;
/**
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;
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;
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 {
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;
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 {
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")
package org.tizen.webuibuilder.ui.views.newnscreen;
+import java.util.ArrayList;
+
public class NScreenModel {
public enum Orientation {
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;
}
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;
}
return width;
}
- public void setWidth(int width) {
+ public void setWidth( int width ) {
this.width = width;
}
return height;
}
- public void setHeight(int height) {
+ public void setHeight( int height ) {
this.height = height;
}
return fileName;
}
- public void setFileName(String fileName) {
+ public void setFileName( String fileName ) {
this.fileName = fileName;
}
return color;
}
- public void setColor(int color) {
+ public void setColor( int color ) {
this.color = color;
}
return colorIndex;
}
- public void setColorIndex(int colorIndex) {
+ public void setColorIndex( int colorIndex ) {
this.colorIndex = colorIndex;
}
return deviceHeight;
}
- public void setDeviceHeight(int deviceHeight) {
+ public void setDeviceHeight( int deviceHeight ) {
this.deviceHeight = deviceHeight;
}
return deviceWidth;
}
- public void setDeviceWidth(int deviceWidth) {
+ public void setDeviceWidth( int deviceWidth ) {
this.deviceWidth = deviceWidth;
}
return orientation;
}
- public void setOrientation(Orientation orientation) {
+ public void setOrientation( Orientation orientation ) {
this.orientation = orientation;
}
return monochrome;
}
- public void setMonochrome(int monochrome) {
+ public void setMonochrome( int monochrome ) {
this.monochrome = monochrome;
}
return resolution;
}
- public void setResolution(String resolution) {
+ public void setResolution( String resolution ) {
this.resolution = resolution;
}
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;
}
}
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 );
}
}