--- /dev/null
+/*
+ * UI Builder
+ *
+ * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+
+package org.tizen.webuibuilder.ui.views.nscreen2;
+
+public class NScreenModel {
+
+ public enum Orientation {
+ LANDSCAPE, PORTRAIT
+ }
+
+ public enum Scan {
+ PROGRESSIVE, INTERLACE
+ }
+
+ private String title;
+
+ private int width;
+ private int height;
+ private int color;
+ private int colorIndex;
+ private int deviceHeight;
+ private int deviceWidth;
+ private Orientation orientation;
+ private int monochrome;
+ private String resolution;
+ private Scan scan;
+ private int grid;
+
+ private String fileName;
+
+ NScreenModel link;
+
+ public NScreenModel(String title, int width, int height, String fileName) {
+ this.title = title;
+ this.width = width;
+ this.height = height;
+ this.fileName = fileName;
+ }
+
+ public NScreenModel() {
+ this("Basic", 0, 0, "");
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public int getWidth() {
+ return width;
+ }
+
+ public void setWidth(int width) {
+ this.width = width;
+ }
+
+ public int getHeight() {
+ return height;
+ }
+
+ public void setHeight(int height) {
+ this.height = height;
+ }
+
+ public String getFileName() {
+ return fileName;
+ }
+
+ public void setFileName(String fileName) {
+ this.fileName = fileName;
+ }
+
+ public int getColor() {
+ return color;
+ }
+
+ public void setColor(int color) {
+ this.color = color;
+ }
+
+ public int getColorIndex() {
+ return colorIndex;
+ }
+
+ public void setColorIndex(int colorIndex) {
+ this.colorIndex = colorIndex;
+ }
+
+ public int getDeviceHeight() {
+ return deviceHeight;
+ }
+
+ public void setDeviceHeight(int deviceHeight) {
+ this.deviceHeight = deviceHeight;
+ }
+
+ public int getDeviceWidth() {
+ return deviceWidth;
+ }
+
+ public void setDeviceWidth(int deviceWidth) {
+ this.deviceWidth = deviceWidth;
+ }
+
+ public Orientation getOrientation() {
+ return orientation;
+ }
+
+ public void setOrientation(Orientation orientation) {
+ this.orientation = orientation;
+ }
+
+ public int getMonochrome() {
+ return monochrome;
+ }
+
+ public void setMonochrome(int monochrome) {
+ this.monochrome = monochrome;
+ }
+
+ public String getResolution() {
+ return resolution;
+ }
+
+ public void setResolution(String resolution) {
+ this.resolution = resolution;
+ }
+
+ public Scan getScan() {
+ return scan;
+ }
+
+ public void setScan(Scan scan) {
+ this.scan = scan;
+ }
+
+ public int getGrid() {
+ return grid;
+ }
+
+ public void setGrid(int grid) {
+ this.grid = grid;
+ }
+
+ public String getOriginFileName() {
+ return fileName;
+ }
+
+ public String getAspectRatio() {
+ return reduceRatio(width, height);
+ }
+
+ public String getDeviceAspectRatio() {
+ return reduceRatio(deviceWidth, deviceHeight);
+ }
+
+ public String reduceRatio(int numerator, int denominator) {
+ int temp = 0;
+
+ if (numerator == denominator)
+ return "1:1";
+
+ if (+numerator < +denominator) {
+ temp = numerator;
+ numerator = denominator;
+ denominator = temp;
+ }
+
+ int divisor = gcd(+numerator, +denominator);
+
+ return (numerator / divisor) + "/" + (denominator / divisor);
+ }
+
+ 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;
+
+ }
+}