// pageData.addPageListener(this);
}
}
-
+
}
} else {
// appManager = new AppManager(projectManager, null);
String page = "data-role=\"page\""; //$NON-NLS-1$
String newHtml = null;
- if (html.contains(page)) {
- String id = BuilderConstants.PROPERTY_ID + BuilderConstants.EQUAL
- + BuilderConstants.QUOTATION_MARK;
- int startIndex = html.indexOf(id, html.indexOf(page)) + 4;
- String startHtml = html.substring(0, startIndex);
- int endIndex = html.indexOf(BuilderConstants.QUOTATION_MARK,
- startIndex);
- String endHtml = html.substring(endIndex, html.length());
- newHtml = startHtml + pageName + endHtml;
- }
- return (newHtml != null) ? HtmlReader.loadHtmlStream(this,
- new ByteArrayInputStream(newHtml.getBytes())) : null;
- }
-
+ if (html.contains(page)) {
+ String id =
+ BuilderConstants.PROPERTY_ID + BuilderConstants.EQUAL
+ + BuilderConstants.QUOTATION_MARK;
+ int startIndex = html.indexOf(id, html.indexOf(page)) + 4;
+ String startHtml = html.substring(0, startIndex);
+ int endIndex = html.indexOf(BuilderConstants.QUOTATION_MARK, startIndex);
+ String endHtml = html.substring(endIndex, html.length());
+ newHtml = startHtml + pageName + endHtml;
+ }
+ return (newHtml != null) ? HtmlReader.loadHtmlStream(this,
+ new ByteArrayInputStream(newHtml
+ .getBytes())) : null;
+ }
+
@Override
public void addPage(PageData page, boolean isExistsPagePart) {
String path = null;
getProjectManager().getProject().getFile(page.getPagePath())
.getProjectRelativePath().toString();
} else {
- path = pageFileName.substring(0,
- pageFileName.lastIndexOf("/", pageFileName.length()-1));
+ path =
+ pageFileName
+ .substring(0, pageFileName.lastIndexOf("/", pageFileName.length() - 1));
}
-
+
pageDataSet.addPage(page, path, isExistsPagePart);
-
- if(isExistsPagePart) {
- DomUtil.appendPageNode(document, DomUtil.BODY_ELEMENT, page.getPagePart().getElement());
+
+ if (isExistsPagePart) {
+ DomUtil.appendPageNode(document, DomUtil.BODY_ELEMENT, page.getPagePart().getElement());
}
}
-
+
@Override
public void addPage(int index, PageData page, boolean isExistsPagePart) {
String path = null;
getProjectManager().getProject().getFile(page.getPagePath())
.getProjectRelativePath().toString();
} else {
- path = pageFileName.substring(0,
- pageFileName.lastIndexOf('/', pageFileName.length()-1));
+ path =
+ pageFileName
+ .substring(0, pageFileName.lastIndexOf('/', pageFileName.length() - 1));
}
-
- if(isExistsPagePart) {
- PageData refPageData = getPageByIndex(index);
- DomUtil.insertBeforePageNode(document, DomUtil.BODY_ELEMENT, page.getPagePart().getElement(),
- (refPageData != null) ? refPageData.getPagePart().getElement() : null);
+
+ if (isExistsPagePart) {
+ PageData refPageData = getPageByIndex(index);
+ DomUtil.insertBeforePageNode(document, DomUtil.BODY_ELEMENT, page.getPagePart()
+ .getElement(), (refPageData != null) ? refPageData.getPagePart().getElement()
+ : null);
}
pageDataSet.addPage(index, page, path, isExistsPagePart);
}
-
+
public void addPage(String html, String pageName) {
if (html == null || pageName == null) {
return;
@Override
public void removePage(int index) {
-
- DomUtil.removePageNode(document, DomUtil.BODY_ELEMENT, getPageData(index).getPagePart().getElement());
-
- pageDataSet.removePageWithPart(index);
-
- if (index == startupPage) {
- if (getPages().size() > 0) {
- if (index >= getPages().size()) {
- index = getPages().size() - 1;
- }
- setStartupPage(index);
- } else {
- setStartupPage(-1);
- }
- }
+
+ DomUtil.removePageNode(document, DomUtil.BODY_ELEMENT, getPageData(index).getPagePart()
+ .getElement());
+
+ pageDataSet.removePageWithPart(index);
+
+ if (index == startupPage) {
+ if (getPages().size() > 0) {
+ if (index >= getPages().size()) {
+ index = getPages().size() - 1;
+ }
+ setStartupPage(index);
+ } else {
+ setStartupPage(-1);
+ }
+ }
}
-
+
@Override
public void removeAllPages() {
pageDataSet.removeAllPagesWithPart();
public Document getDocument() {
return document;
}
-
+
public void setDocument(Document document) {
- this.document = document;
+ this.document = document;
}
-
+
public String getPageFileName() {
- return this.pageFileName;
+ return this.pageFileName;
}
@Override
head.insertBefore(newElmBase, head.getFirstChild());
String html = null;
+ String css = null;
if (rootPart != null) {
Part part = null;
if (rootPart.isDocumentPart()) {
html =
CodeGenerator.generateCode(part, false, getDescriptorManager()
.getXsltDocument(), false);
+ css = CodeGenerator.generateCssCode(part);
}
Element newElm = editDoc.createElement("script");
newElm.setAttribute("src", "./tizen-ui-builder-tool/res/html/preview.js");
head.appendChild(newElm);
+ Element newElm2 = editDoc.createElement("style");
+ newElm2.setAttribute("type", "text/css");
+ newElm2.setAttribute("id", "page_style");
+ newElm2.setTextContent("%css%");
+ head.appendChild(newElm2);
+
NodeList bodys = editDoc.getElementsByTagName("body");
Element body = null;
if (bodys == null) {
for (int i = 0; i < len; i++) {
body.removeChild(body.getFirstChild());
}
+ body.setTextContent("%html%");
if (html == null) {
html = "";
}
- body.setTextContent("%html%");
+ if (css == null) {
+ css = "";
+ }
// String tempHtml =
// HtmlWriter.writeToString((Element)editDoc.getFirstChild().getChildNodes().item(index));
String tempHtml = HtmlWriter.writeToString(editDoc);
tempHtml = tempHtml.replace("%html%", html);
+ tempHtml = tempHtml.replace("%css%", css);
return tempHtml;
}