private static FontRegistry fontRegistry = new FontRegistry();
private static final Font defaultFont = getDADefaultFont();
- // * Toolbal Layout
- // Combo botton text font
- public static final Font COMBO = getFont("combo", resizeDefaultFont(9, 2));//$NON-NLS-1$
- // mac 11
-
- // Combo drop-down list text font
- public static final Font DROPDOWN = getFont("dropdown", resizeDefaultFont(9, 2));//$NON-NLS-1$
- // mac 11
-
- // Timer
- public static final Font TIMER = getFont("timer", resizeDefaultFont(12, 5));//$NON-NLS-1$
- // mac version 17
-
- // tab button font
- public static final Font TAB_BUTTON_FONT = getFont("tab_button_font", resizeDefaultFont(8, 3));//$NON-NLS-1$
- // mac 11
-
- // * Time-Line Layout
- // Edit Chart Dlg.
- public static final Font ADDITEM_BUTTON_FONT =
- getFont("additem_button_font", resizeDefaultFont(8, 3));//$NON-NLS-1$
- // mac 11
-
- public static final Font FLOATING = getFont("float_renderer", resizeDefaultFont(14, 1));//$NON-NLS-1$
- // mac 11
-
public static final Font NSCREEN_TITLE =
getFont("nscreen_title", setDefaultFontStyleAndSize(SWT.ITALIC, 15));//$NON-NLS-1$
// mac 11
public static final Font DEVICE = getFont("nscreen_device", resizeDefaultFont(12, 1));//$NON-NLS-1$
// mac 11
- // ui event text font
- public static final Font TIMELINE_UIEVENT_FONT =
- getFont("timeline_uievent_font", resizeDefaultFont(7, 3));//$NON-NLS-1$
-
- // * Open Trace
- // Inner title : saved file and temporary file
- public static final Font OPEN_TRACE_INNER_TITLE =
- getFont("open_trace_inner_title", resizeDefaultFont(9, 2));//$NON-NLS-1$
- // mac 11
-
- // * Edit Chart
- // Title
- public static final Font EDIT_CHART_DLG_TITLE =
- getFont("edit_chart_dlg_title", resizeDefaultFont(9, 0));//$NON-NLS-1$
- // Button
- public static final Font EDIT_CHART_DLG_BUTTON =
- getFont("edit_chart_dlg_button", resizeDefaultFont(9, 2));//$NON-NLS-1$
- // Item Name
- public static final Font EDIT_CHART_DLG_ITEM_NAME =
- getFont("edit_chart_item_name", resizeDefaultFont(9, 2));//$NON-NLS-1$
- // Item SubName
- public static final Font EDIT_CHART_DLG_ITEM_SUB_NAME =
- getFont("edit_chart_item_sub_name", resizeDefaultFont(9, 2));//$NON-NLS-1$
-
- // DA table header and header group font
- public static final Font TABLE_HEADER_FONT =
- getFont("table_header_font", resizeDefaultFont(8, 3));//$NON-NLS-1$
- // mac 11
-
- // DA table cell font (contents font)
- public static final Font TABLE_CELL_FONT = getFont("table_cell_font", resizeDefaultFont(8, 3));//$NON-NLS-1$
- // mac 11
-
- public static final Font EXPLORER_CELL_FONT =
- getFont("table_cell_font", resizeDefaultFont(15, 3));//$NON-NLS-1$
-
- public static final Font DETAIL_INFO_FONT =
- getFont("detail_info_font", resizeDefaultFont(8, 3));//$NON-NLS-1$
- // mac 11
-
- // * About Dlg.
- public static final Font ABOUT_TEXT = getFont("about_text", resizeDefaultFont(9, 2));//$NON-NLS-1$
- // mac 11
- public static final Font DIALOG_BUTTON_FONT =
- getFont("dialog_button_font", resizeDefaultFont(9, 2));//$NON-NLS-1$
- // mac 11
-
- // * stop progress dialog
- public static final Font STOP_PROGRESS_FONT =
- getFont("stop_progress_font", resizeDefaultFont(8, 3));//$NON-NLS-1$
- public static final Font PROGRESS_FONT = getFont("progress_font", resizeDefaultFont(9, 3));//$NON-NLS-1$
-
- // * not support
- public static final Font TOOLTIP = getFont("tooltip", resizeDefaultFont(10, 1));//$NON-NLS-1$
- public static final Font CIRCULAR_GRAPH_VALUE_FONT =
- getFont("circular_graph_value_font", resizeDefaultFont(13, 5));//$NON-NLS-1$
- // mac 18
-
- public static final Font CIRCULAR_GRAPH_MEASURE_FONT =
- getFont("circular_graph_measure_font", resizeDefaultFont(8, 3));//$NON-NLS-1$
- // mac 11
-
- public static final Font CIRCULAR_LABEL_FONT =
- getFont("circular_label_font", resizeDefaultFont(8, 3));//$NON-NLS-1$
- // mac 11
-
- public static final Font BAR_GRAPH_LABEL_FONT =
- getFont("bar_graph_label_font", resizeDefaultFont(8, 3));//$NON-NLS-1$
- // mac 11
-
- public static final Font BAR_GRAPH_FONT = getFont("bar_graph_font", resizeDefaultFont(6, 5));//$NON-NLS-1$
- // mac 11
-
- public static final Font LOCK_LABEL_FONT = getFont("lock_label_font", resizeDefaultFont(8, 3));//$NON-NLS-1$
-
- public static final Font SCORE_TITLE_FONT =
- getFont("score_title_font", setDefaultFontStyleAndSize(SWT.BOLD, 10));//$NON-NLS-1$
-
- // * chart
- public static final Font CHART_TOOLTIP_FONT =
- getFont("chart_tootip_font", resizeDefaultFont(8, 3));//$NON-NLS-1$
-
- public static final Font CHART_AXIS_FONT = getFont("chart_axis_font", resizeDefaultFont(8, 3));//$NON-NLS-1$
-
- public static final Font CHART_ARROW_TID_FONT =
- getFont("chart_arrow_tid_font", resizeDefaultFont(7, 3));//$NON-NLS-1$
-
- // * chart board
- public static final Font CHART_NAME_FONT = getFont("chart_name_font", resizeDefaultFont(8, 3));//$NON-NLS-1$
-
- // * context menu
- public static final Font CONTEXT_MENU_TITLE_FONT =
- getFont("context_menu_title_font", resizeDefaultFont(9, 3));//$NON-NLS-1$
-
- public static final Font CONTEXT_MENU_ITEM_FONT =
- getFont("context_menu_item_font", resizeDefaultFont(9, 3));//$NON-NLS-1$
-
- // * configuration
- public static final Font CONFIGURATION_TABLE_TITLE_FONT =
- getFont("configuration_table_title_font", resizeDefaultFont(9, 3));//$NON-NLS-1$
-
- // timeline
- public static final Font TIMELINE_FONT = getFont("timeline_font", resizeDefaultFont(8, 3)); //$NON-NLS-1$
-
- public static final Font TIMELINE_TICK_FONT = getFont("time_tick", resizeDefaultFont(6, 3));//$NON-NLS-1$
- public static final Font TIMELINE_BALLOON_FONT =
- getFont("time_balloon", resizeDefaultFont(8, 3));//$NON-NLS-1$
private static Font getFont(String fontName, FontData[] fontData) {
if (!fontRegistry.hasValueFor(fontName)) {
+++ /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.nscreen;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.List;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.gef.commands.Command;
-import org.tizen.webuibuilder.model.css.CssFile;
-import org.tizen.webuibuilder.model.nscreen.NScreenModel;
-
-
-/**
- * A class that implements Command. This class run an operation to add new Nscreen.
- */
-public class NScreenAddCommand extends Command {
- private List<NScreenModel> mList = null;
- private NScreenModel mModel = null;
- private NScreenList mNscreenList = null;
- private NScreenListItem mItem = null;
-
- public NScreenAddCommand(List<NScreenModel> list, NScreenModel model, NScreenList screenList) {
- mList = list;
- mModel = model;
- mNscreenList = screenList;
- }
-
- @Override
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.gef.commands.Command#execute()
- */
- public void execute() {
- mList.add(mModel);
-
- String filePath = mNscreenList.getNScreenPageModel().getAppManager().getCssFolder();
- CssFile cssFile = new CssFile( filePath + IPath.SEPARATOR + mModel.getFileName() );
- File newCSSFile = new File( filePath + IPath.SEPARATOR + mModel.getFileName() );
-
- try {
- if (!newCSSFile.exists()) {
- File dir = newCSSFile.getParentFile();
- dir.mkdirs();
- newCSSFile.createNewFile();
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- if (mNscreenList != null && !mNscreenList.getControl().isDisposed()) {
- mNscreenList.getNScreenPageModel().getPageData().addCssFile( cssFile );
- mItem = mNscreenList.addItem(mModel, false);
- mNscreenList.layout();
- }
- }
-
- @Override
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.gef.commands.Command#redo()
- */
- public void redo() {
- execute();
- }
-
- @Override
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.gef.commands.Command#undo()
- */
- public void undo() {
- File nscreenCssFile = new File(mModel.getFileName());
- if (nscreenCssFile.exists()) {
- nscreenCssFile.delete();
- }
- mList.remove(mModel);
- if (mNscreenList != null && !mNscreenList.getControl().isDisposed()) {
- mNscreenList.removeItem(mItem);
- mNscreenList.layout();
- }
- }
-
-}
+++ /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.nscreen;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.tizen.webuibuilder.model.nscreen.NScreenModel;
-
-
-/**
- * A class that implements Dialog. This class is responsible for the dialog box to add a Nscreen.
- */
-public class NScreenCustomDialog extends Dialog {
- private Display mDisplay;
- private Text mTitle;
- private Text mWidth;
- private Text mHeight;
- private Text mCssFileName;
- private Label mNotification;
- private NScreenPage mNScreenPage;
- private NScreenListItem mItem = null;
-
- protected NScreenCustomDialog(Shell parentShell, NScreenPage nScreenPage, NScreenListItem item) {
- super(parentShell);
- mDisplay = parentShell.getDisplay();
- mNScreenPage = nScreenPage;
- mItem = item;
- }
-
- @Override
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
- */
- protected Control createDialogArea(Composite parent) {
- Composite container = (Composite) super.createDialogArea(parent);
- GridLayout layout = (GridLayout) container.getLayout();
- layout.numColumns = 2;
-
- Label title = new Label(container, SWT.RIGHT);
- title.setText(NScreenViewMessages.LABEL_TITLE + " : ");
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END);
- title.setLayoutData(data);
-
- mTitle = new Text(container, SWT.SINGLE);
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = 150;
- mTitle.setLayoutData(data);
- if (mItem != null) {
- mTitle.setText(mItem.getModel().getName());
- }
-
- Label width = new Label(container, SWT.RIGHT);
- width.setText(NScreenViewMessages.LABEL_WIDTH + " : ");
- data = new GridData(GridData.HORIZONTAL_ALIGN_END);
- width.setLayoutData(data);
-
- mWidth = new Text(container, SWT.SINGLE);
- data = new GridData(GridData.FILL_HORIZONTAL);
- mWidth.setLayoutData(data);
- if (mItem != null) {
- mWidth.setText(String.valueOf(mItem.getModel().getWidth()));
- }
-
- Label height = new Label(container, SWT.RIGHT);
- height.setText(NScreenViewMessages.LABEL_HEIGHT + " : ");
- data = new GridData(GridData.HORIZONTAL_ALIGN_END);
- height.setLayoutData(data);
-
- mHeight = new Text(container, SWT.SINGLE);
- data = new GridData(GridData.FILL_HORIZONTAL);
- mHeight.setLayoutData(data);
- if (mItem != null) {
- mHeight.setText(String.valueOf(mItem.getModel().getHeight()));
- }
-
- Label cssFileName = new Label(container, SWT.RIGHT);
- cssFileName.setText(NScreenViewMessages.LABEL_CSS_FILE_NAME + " : ");
- data = new GridData(GridData.HORIZONTAL_ALIGN_END);
- cssFileName.setLayoutData(data);
-
- mCssFileName = new Text(container, SWT.SINGLE);
- data = new GridData(GridData.FILL_HORIZONTAL);
- mCssFileName.setLayoutData(data);
- if (mItem != null) {
- mCssFileName.setText(String.valueOf(mItem.getModel().getFileName()));
- }
-
- mNotification = new Label(container, SWT.CENTER);
- mNotification.setForeground(mDisplay.getSystemColor(SWT.COLOR_RED));
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 2;
- mNotification.setLayoutData(data);
-
- return container;
- }
-
- @Override
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
- */
- protected void buttonPressed(int buttonId) {
- if (buttonId == IDialogConstants.OK_ID) {
- if (mItem == null) {
- if (checkAddNewScreen()) {
- super.buttonPressed(buttonId);
- return;
- }
- } else {
- if (checkEditScreen()) {
- super.buttonPressed(buttonId);
- return;
- }
- }
- } else {
- super.buttonPressed(buttonId);
- }
- }
-
- private boolean checkAddNewScreen() {
- String title = mTitle.getText();
- if (title.isEmpty()) {
- mNotification.setText("Title field is empty.");
- return false;
- }
-
- int width;
- try {
- width = Integer.parseInt(mWidth.getText());
- } catch (Exception e) {
- mNotification.setText("Please width field enter a number");
- return false;
- }
- if (mNScreenPage.existNscreen(width)) {
- mNotification.setText("Already exists screen width");
- return false;
- }
-
- int height;
- try {
- height = Integer.parseInt(mHeight.getText());
- } catch (Exception e) {
- mNotification.setText("Please height field enter a number");
- return false;
- }
-
- String cssFileName = mCssFileName.getText();
- if (cssFileName.isEmpty()) {
- mNotification.setText("CSS file name field is empty.");
- return false;
- }
-
- mNScreenPage.addNewNscreen(title, width, height, cssFileName, false);
- return true;
- }
-
- private boolean checkEditScreen() {
- String title = mTitle.getText();
- if (title.isEmpty()) {
- mNotification.setText("Title field is empty.");
- return false;
- }
-
- int width;
- try {
- width = Integer.parseInt(mWidth.getText());
- } catch (Exception e) {
- mNotification.setText("Please width field enter a number");
- return false;
- }
- if (mItem.getModel().getWidth() != width) {
- if (mNScreenPage.existNscreen(width)) {
- mNotification.setText("Already exists screen width");
- return false;
- }
- }
-
- int height;
- try {
- height = Integer.parseInt(mHeight.getText());
- } catch (Exception e) {
- mNotification.setText("Please height field enter a number");
- return false;
- }
-
- String cssFileName = mCssFileName.getText();
- if (cssFileName.isEmpty()) {
- mNotification.setText("CSS file name field is empty.");
- return false;
- }
-
- NScreenModel model = mItem.getModel();
- model.setName(title);
- model.setWidth(width);
- model.setHeight(height);
- model.setFileName(cssFileName);
-
- mItem.setTitleText(title);
- mItem.setWidthText(mItem.makeWidthText(width));
- mItem.setHeightText(mItem.makeHeightText(height));
- mItem.setCssText(cssFileName);
- mItem.mContainer.layout(true, true);
- return true;
- }
-
- @Override
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.dialogs.Dialog#configureShell(org.eclipse.swt.widgets.Shell)
- */
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- newShell.setText(NScreenViewMessages.LABEL_CUSTOM_DIALOG);
- }
-
-}
+++ /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.nscreen;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.List;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.gef.commands.Command;
-import org.tizen.webuibuilder.model.css.CssFile;
-import org.tizen.webuibuilder.model.nscreen.NScreenModel;
-
-
-/**
- * A class that implements Command. This class run the operation to remove the existing Nscreen.
- */
-public class NScreenDeleteCommand extends Command {
- private List<NScreenModel> mList = null;
- private NScreenModel mModel = null;
- private NScreenList mNscreenList = null;
- private NScreenListItem mItem = null;
-
- public NScreenDeleteCommand(List<NScreenModel> list, NScreenListItem item, NScreenList screenList) {
- mList = list;
- mItem = item;
- mNscreenList = screenList;
- mModel = item.getModel();
- }
-
- @Override
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.gef.commands.Command#execute()
- */
- public void execute() {
- String filePath = mNscreenList.getNScreenPageModel().getAppManager().getCssFolder();
- CssFile cssFile = new CssFile( filePath + IPath.SEPARATOR + mModel.getFileName() );
- File nscreenCssFile = new File( filePath + IPath.SEPARATOR + mModel.getFileName() );
-
- if (nscreenCssFile.exists()) {
- nscreenCssFile.delete();
- }
- mList.remove(mModel);
- if (mNscreenList != null && !mNscreenList.getControl().isDisposed()) {
- mNscreenList.getNScreenPageModel().getPageData().removeCssFile( cssFile );
- mNscreenList.removeItem(mItem);
- mNscreenList.layout();
- }
- }
-
- @Override
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.gef.commands.Command#redo()
- */
- public void redo() {
- super.redo();
- }
-
- @Override
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.gef.commands.Command#undo()
- */
- public void undo() {
- mList.add(mModel);
-
- try {
- File newCSSFile = new File(mModel.getFileName());
- newCSSFile.createNewFile();
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- if (mNscreenList != null && !mNscreenList.getControl().isDisposed()) {
- mItem = mNscreenList.addItem(mModel, false);
- mNscreenList.layout();
- }
- }
-}
+++ /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.nscreen;
-
-import java.util.ArrayList;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.ScrolledComposite;
-import org.eclipse.swt.events.ControlAdapter;
-import org.eclipse.swt.events.ControlEvent;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.tizen.webuibuilder.model.css.CssFile;
-import org.tizen.webuibuilder.model.nscreen.NScreenModel;
-import org.tizen.webuibuilder.ui.views.nscreen.model.NScreenPageModel;
-
-
-/**
- * The NScreenList class is responsible for a List is shown in the NScreenView.
- */
-public class NScreenList {
- private Composite mContainer;
- private ArrayList<NScreenListItem> mWidgetList;
- private ScrolledComposite mScrolledContainer;
- private NScreenPageModel mNScreenPageModel;
-
- public NScreenPageModel getNScreenPageModel() {
- return mNScreenPageModel;
- }
-
- private FormData makeFormData(NScreenListItem front) {
- FormData fd_item = new FormData();
- if (front == null) {
- fd_item.top = new FormAttachment(0);
- } else {
- fd_item.top = new FormAttachment(front.mContainer, 3);
- }
- fd_item.left = new FormAttachment(0);
- fd_item.right = new FormAttachment(100);
- return fd_item;
- }
-
- /**
- * list init method
- *
- * @param parent
- * @param nScreenPageModel
- */
- public NScreenList(Composite parent, NScreenPageModel nScreenPageModel) {
- mNScreenPageModel = nScreenPageModel;
-
- mWidgetList = new ArrayList<NScreenListItem>();
- mScrolledContainer = new ScrolledComposite(parent, SWT.V_SCROLL);
- mContainer = new Composite(mScrolledContainer, SWT.NONE);
- mContainer.setLayout(new FormLayout());
-
- mScrolledContainer.setContent(mContainer);
- mScrolledContainer.setExpandVertical(true);
- mScrolledContainer.setExpandHorizontal(true);
- mScrolledContainer.addControlListener(new ControlAdapter() {
- public void controlResized(ControlEvent e) {
- Rectangle r = mScrolledContainer.getClientArea();
- mScrolledContainer.setMinSize(mContainer.computeSize(r.width, SWT.DEFAULT));
- }
- });
- }
-
- /**
- * NScreen Add method refer
- *
- * @param model
- * @param isSelected
- * @return NScreenListItem instance
- */
- public NScreenListItem addItem(NScreenModel model, boolean isSelected) {
- return addItem(mWidgetList.size(), model, isSelected);
- }
-
- /**
- * NScreen Add method
- *
- * @param index
- * @param model
- * @param isSelected
- * @return NScreenListItem instance
- */
- public NScreenListItem addItem(int index, NScreenModel model, boolean isSelected) {
- if (index > mWidgetList.size()) {
- return null;
- }
-
- NScreenListItem item = new NScreenListItem(mContainer, this, model);
-
- NScreenListItem front = null;
- if (index != 0) {
- front = mWidgetList.get(index - 1);
- }
- item.mContainer.setLayoutData(makeFormData(front));
-
- if (index != mWidgetList.size()) {
- mWidgetList.get(index).mContainer.setLayoutData(makeFormData(item));
- }
-
- mWidgetList.add(index, item);
- if (isSelected) {
- selected(item);
- }
- mNScreenPageModel.getPageData().addPageListener(item);
- return item;
- }
-
- public void layout() {
- mContainer.layout();
- Rectangle r = mScrolledContainer.getClientArea();
- mScrolledContainer.setMinSize(mContainer.computeSize(r.width, SWT.DEFAULT));
- }
-
- public Control getControl() {
- return mScrolledContainer;
- }
-
- /**
- * remove Nscreen
- *
- * @param item
- * NscreenListItem to delete
- */
- public void removeItem(NScreenListItem item) {
- for (int i = 0; i < mWidgetList.size(); i++) {
- NScreenListItem listItem = mWidgetList.get(i);
- if (listItem.equals(item)) {
- removeItem(i);
- return;
- }
- }
-
- }
-
- /**
- * remove Nscreen
- *
- * @param index
- * NscreenListItem index to delete
- */
- public void removeItem(int index) {
- if (mWidgetList.size() < index + 1) {
- return;
- } else if (mWidgetList.size() > index + 1) {
- if (index == 0) {
- NScreenListItem back = mWidgetList.get(index + 1);
- back.mContainer.setLayoutData(makeFormData(null));
- } else {
- NScreenListItem front = mWidgetList.get(index - 1);
- NScreenListItem back = mWidgetList.get(index + 1);
- back.mContainer.setLayoutData(makeFormData(front));
- }
- }
-
- NScreenListItem removeItem = mWidgetList.remove(index);
- removeItem.dispose();
-
- }
-
- public int size() {
- return mWidgetList.size();
- }
-
- /**
- * doing remove NscreenListItem, change selection to default Item.
- */
- public void defaultSelected() {
- if (mWidgetList.size() == 0) {
- return;
- }
- NScreenListItem item = mWidgetList.get(0);
- item.clicked();
- }
-
- /**
- * selction target listItem.
- *
- * @param selectedItem
- */
- public void selected(NScreenListItem selectedItem) {
-
- for (NScreenListItem item : mWidgetList) {
- if (item.isSelected()) {
- item.setSelected(false);
- }
- }
- selectedItem.setSelected(true);
-
- }
-
- /**
- * remove all NscreenListItems
- */
- public void removeAll() {
- if (mWidgetList.size() == 0) {
- return;
- }
- for (NScreenListItem item : mWidgetList) {
- item.dispose();
- }
- mWidgetList.clear();
- }
-
-}
+++ /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.nscreen;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.events.MouseTrackAdapter;
-import org.eclipse.swt.events.MouseTrackListener;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.tizen.webuibuilder.model.nscreen.NScreenModel;
-import org.tizen.webuibuilder.model.page.IPageDataListener;
-import org.tizen.webuibuilder.model.page.PageDataEvent;
-
-
-/**
- * The NScreenListItem class is responsible for every single item in NScreenList. The
- * NScreenListItem class that implements IPageDataListener.
- */
-public class NScreenListItem implements IPageDataListener {
- private NScreenList mList;
- private NScreenModel mModel;
- public Composite mContainer;
- public Composite mRightContainer;
- // private NScreenListItemImageComposite mSnapShot;
- private Label mSnapShot;
- private Label mTitle;
- private Label mWidthLabel;
- private Label mHeightLabel;
- private Label mCss;
-
- private boolean mIsSelected = false;
-
- private Menu mPopupMenu;
- private MenuItem mPopupMenuAdd;
- // private MenuItem mPopupMenuEdit;
- private MenuItem mPopupMenuDel;
-
- private MouseTrackListener mMouseTrackListener = new MouseTrackAdapter() {
-
- @Override
- public void mouseExit(MouseEvent e) {
- Color color = null;
- Color fontColor = null;
- if (mIsSelected) {
- color = e.display.getSystemColor(SWT.COLOR_LIST_SELECTION);
- fontColor = e.display.getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT);
- } else {
- color = e.display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
- fontColor = e.display.getSystemColor(SWT.COLOR_LIST_FOREGROUND);
- }
- drawBackgroundAllControl(color, fontColor);
- }
-
- @Override
- public void mouseEnter(MouseEvent e) {
- Color color = e.display.getSystemColor(SWT.COLOR_TITLE_BACKGROUND_GRADIENT);
- Color fontColor = e.display.getSystemColor(SWT.COLOR_LIST_FOREGROUND);
- drawBackgroundAllControl(color, fontColor);
- }
-
- };
- private MouseListener mMouseListener = new MouseAdapter() {
-
- @Override
- public void mouseUp(MouseEvent e) {
- clicked();
- }
-
- };
-
- private void drawBackgroundAllControl(Color backgroundColor, Color fontColor) {
- Control[] children = mContainer.getChildren();
- for (Control control : children) {
- control.setBackground(backgroundColor);
- control.setForeground(fontColor);
- }
- children = mRightContainer.getChildren();
- for (Control control : children) {
- control.setBackground(backgroundColor);
- control.setForeground(fontColor);
- }
- mContainer.setBackground(backgroundColor);
- }
-
- private void createPopupMenu() {
- mPopupMenu = new Menu(mContainer.getShell(), SWT.POP_UP);
-
- mPopupMenuAdd = new MenuItem(mPopupMenu, SWT.PUSH);
- mPopupMenuAdd.setText(NScreenViewMessages.ACTION_LABEL_ADD_NSCREEN);
- mPopupMenuAdd.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- mList.getNScreenPageModel().getNScreenPage().customScreenDialogAddEdit(null);
- }
- });
-
- if (mModel.getWidth() != 0) {
- mPopupMenuDel = new MenuItem(mPopupMenu, SWT.PUSH);
- mPopupMenuDel.setText(NScreenViewMessages.ACTION_LABEL_DEL_NSCREEN);
- mPopupMenuDel.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- mList.getNScreenPageModel().getNScreenPage()
- .deleteNScreen(NScreenListItem.this);
- }
-
- });
- }
- }
-
- public void refreshImage() {
- // mSnapShot.load();
- }
-
- public void clicked() {
- mList.selected(NScreenListItem.this);
- mContainer.setFocus();
- mList.getNScreenPageModel().getPageDesigner().setNscreenIndex(mModel);
- if (mModel.getWidth() != 0) {
- mList.getNScreenPageModel().getPageDesigner()
- .setShowingSize(mModel.getWidth(), mModel.getHeight());
- }
- }
-
- public void setSelected(boolean isSelected) {
- if (mIsSelected == isSelected) {
- return;
- }
- mIsSelected = isSelected;
-
- Color color = null;
- Color fontColor = null;
- Display display = mContainer.getDisplay();
- if (mIsSelected) {
- color = display.getSystemColor(SWT.COLOR_LIST_SELECTION);
- fontColor = display.getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT);
- } else {
- color = display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
- fontColor = display.getSystemColor(SWT.COLOR_LIST_FOREGROUND);
- }
- drawBackgroundAllControl(color, fontColor);
- }
-
- public boolean isSelected() {
- return mIsSelected;
- }
-
- public void setTitleText(String text) {
- mTitle.setText(text);
- }
-
- public void setWidthText(String text) {
- mWidthLabel.setText(text);
- }
-
- public void setHeightText(String text) {
- mHeightLabel.setText(text);
- }
-
- public void setCssText(String text) {
- mCss.setText(text);
- }
-
- public NScreenListItem(Composite parent, NScreenList nScreenList, NScreenModel model) {
- mList = nScreenList;
- mModel = model;
- mContainer = new Composite(parent, SWT.NONE);
- mContainer.setLayout(new GridLayout(2, false));
- mContainer.addMouseTrackListener(mMouseTrackListener);
- mContainer.addMouseListener(mMouseListener);
- mContainer.addFocusListener(new FocusListener() {
-
- @Override
- public void focusLost(FocusEvent e) {
- mContainer.redraw();
- }
-
- @Override
- public void focusGained(FocusEvent e) {
- mContainer.redraw();
- }
- });
- mContainer.addPaintListener(new PaintListener() {
- @Override
- public void paintControl(PaintEvent e) {
- Rectangle rect = mContainer.getBounds();
- if (mContainer.isFocusControl()) {
- e.gc.drawFocus(5, 5, rect.width - 10, rect.height - 10);
- }
- }
- });
-
- createChildren();
- createPopupMenu();
-
- Control[] children = mContainer.getChildren();
- for (Control control : children) {
- control.addMouseTrackListener(mMouseTrackListener);
- control.addMouseListener(mMouseListener);
- control.setMenu(mPopupMenu);
- }
- children = mRightContainer.getChildren();
- for (Control control : children) {
- control.addMouseTrackListener(mMouseTrackListener);
- control.addMouseListener(mMouseListener);
- control.setMenu(mPopupMenu);
- }
- mContainer.setMenu(mPopupMenu);
- }
-
- public String makeWidthText(int width) {
- if (width == 0) {
- return "width : default";
- }
- return "width : " + width;
- }
-
- public String makeHeightText(int height) {
- if (height == 0) {
- return "height : default";
- }
- return "height : " + height;
- }
-
- private void createChildren() {
- // mSnapShot = new NScreenListItemImageComposite(mContainer, SWT.NONE,
- // mList.getNScreenPageModel(), mModel);
- mSnapShot = new Label(mContainer, SWT.NONE | SWT.NO_FOCUS);
- GridData data =
- new GridData(GridData.HORIZONTAL_ALIGN_CENTER | GridData.VERTICAL_ALIGN_CENTER);
- mSnapShot.setLayoutData(data);
-
- mRightContainer = new Composite(mContainer, SWT.NONE);
- data =
- new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_CENTER
- | GridData.FILL_BOTH);
- mRightContainer.setLayoutData(data);
- mRightContainer.setLayout(new GridLayout(1, true));
-
- mTitle = new Label(mRightContainer, SWT.NONE | SWT.NO_FOCUS);
- mTitle.setText(mModel.getName());
- data = new GridData();
- data.verticalAlignment = SWT.CENTER;
- data.grabExcessVerticalSpace = true;
- mTitle.setLayoutData(data);
-
- mWidthLabel = new Label(mRightContainer, SWT.NONE | SWT.NO_FOCUS);
- mWidthLabel.setText(makeWidthText(mModel.getWidth()));
- data = new GridData();
- data.verticalAlignment = SWT.CENTER;
- data.grabExcessVerticalSpace = true;
- mWidthLabel.setLayoutData(data);
-
- mHeightLabel = new Label(mRightContainer, SWT.NONE | SWT.NO_FOCUS);
- mHeightLabel.setText(makeHeightText(mModel.getHeight()));
- data = new GridData();
- data.verticalAlignment = SWT.CENTER;
- data.grabExcessVerticalSpace = true;
- mHeightLabel.setLayoutData(data);
-
- mCss = new Label(mRightContainer, SWT.NONE | SWT.NO_FOCUS);
- mCss.setText("" );
- data = new GridData();
- data.verticalAlignment = SWT.CENTER;
- data.grabExcessVerticalSpace = true;
- mCss.setLayoutData(data);
- }
-
- public NScreenModel getModel() {
- return mModel;
- }
-
- /**
- * dispose this instance
- */
- public void dispose() {
- mList = null;
- mModel = null;
- mContainer.dispose();
- }
-
- @Override
- public void pagePreDelete(PageDataEvent e) {
- }
-
- @Override
- public void pageRenamed(PageDataEvent e) {
- }
-
- @Override
- public void pageChanged(PageDataEvent e) {
- }
-
-}
+++ /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.nscreen;
-
-import java.util.Map.Entry;
-
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Composite;
-import org.tizen.webuibuilder.browserwidget.ImageBufferedBrowserWidget;
-import org.tizen.webuibuilder.model.app.AppManager;
-import org.tizen.webuibuilder.model.app.Framework;
-import org.tizen.webuibuilder.model.app.Library;
-import org.tizen.webuibuilder.model.app.Meta;
-import org.tizen.webuibuilder.model.app.Stylesheet;
-import org.tizen.webuibuilder.model.css.CssFile;
-import org.tizen.webuibuilder.ui.views.nscreen.model.NScreenPageModel;
-import org.tizen.webuibuilder.ui.views.pages.PagesViewMessages;
-import org.tizen.webuibuilder.utility.FileIo;
-
-
-/**
- * The NScreenListItemImageComposite class is responsible for widget that receives the inheritance
- * Composite, to display the thumbnail screen overall in the List item.
- */
-public class NScreenListItemImageComposite extends Composite {
-
- private static final int DEF_BROWSER_WIDTH = 360;
- private static final int DEF_BROWSER_HEIGHT = 640;
-
- private int browserWidth = DEF_BROWSER_WIDTH;
- private int browserHeight = DEF_BROWSER_HEIGHT;
-
- private static final int MARGIN_TOP = 7;
- private static final int IMAGE_X = 18;
- private static final int IMAGE_Y = MARGIN_TOP;
- private static final int IMAGE_WIDTH = 64;
- private static final int IMAGE_HEIGHT = 96;
-
- private Rectangle mImageAreaRectangle = null;
- private ImageBufferedBrowserWidget mImageBufferedBrowserWidget = null;
-
- private NScreenPageModel mNScreenPageModel;
- private CssFile mModel;
-
- public NScreenListItemImageComposite(Composite parent, int style,
- NScreenPageModel nScreenPageModel, CssFile model) {
- super(parent, style);
- // setLayout(new FillLayout(SWT.VERTICAL));
- mNScreenPageModel = nScreenPageModel;
- mModel = model;
- mImageBufferedBrowserWidget =
- new ImageBufferedBrowserWidget(this, style, null, false, true);
- recalBrowserArea();
- mImageBufferedBrowserWidget.setEnabled(false);
- mImageBufferedBrowserWidget.setVisible(true);
- load();
- }
-
- public void load() {
- String theme = mNScreenPageModel.getAppManager().getFrameworkTheme();
- String scale = mNScreenPageModel.getAppManager().getFrameworkScale();
- String html = mNScreenPageModel.makeHtml();
- if (html == null) {
- return;
- }
- String css = mNScreenPageModel.makeCSS(mModel);
- update(html, css, theme, scale);
- }
-
- private String makeParamString(String param) {
- for (Entry<String, String> variable : mNScreenPageModel.getAppManager()
- .getFrameworkVariables().entrySet()) {
- param = param.replace("%" + variable.getKey() + "%", variable.getValue());
- }
-
- return param;
- }
-
- private void recalBrowserArea() {
- mImageBufferedBrowserWidget.setBrowserSize(browserWidth, browserHeight);
-
- float scale = (float) IMAGE_WIDTH / browserWidth;
- int w = IMAGE_WIDTH;
- int h = IMAGE_WIDTH * browserHeight / browserWidth;
- if (h > IMAGE_HEIGHT) {
- scale = (float) IMAGE_HEIGHT / browserHeight;
- h = IMAGE_HEIGHT;
- w = IMAGE_HEIGHT * browserWidth / browserHeight;
- }
- mImageAreaRectangle =
- new Rectangle(IMAGE_X + (IMAGE_WIDTH - w) / 2, IMAGE_Y + (IMAGE_HEIGHT - h) / 2, w,
- h);
- mImageBufferedBrowserWidget.setZoomScale(scale);
- mImageBufferedBrowserWidget.setSize(mImageAreaRectangle.width, mImageAreaRectangle.height);
- mImageBufferedBrowserWidget.setLocation(mImageAreaRectangle.x, mImageAreaRectangle.y);
- }
-
- public void update(String body, String css, String theme, String scale) {
- // String contents = ResourceManager.getString(TEMP_FILE);
- AppManager mAppManager = mNScreenPageModel.getAppManager();
- String tempFilePath = mAppManager.getFileFullPath(PagesViewMessages.FILE_THUMBNAIL_HTML);
- String html = FileIo.readFile(tempFilePath);
-
- String pagePathUri = mNScreenPageModel.getPagePathUri();
- if (html != null) {
- String rootPathUri = mNScreenPageModel.getRootPathUri();
- html = html.replace("%root_path%", rootPathUri);
- html = html.replace("%page_path%", pagePathUri);
-
- String framework_script = new String("");
- for (Library library : mAppManager.getAppFileData().getLibraries()) {
- if (library.getType().equals("framework")) {
- if (!framework_script.isEmpty()) {
- framework_script = framework_script + "\n";
- }
- Framework framework =
- mAppManager.getAppFileData().findFramework(library.getParam());
- if (framework == null) {
- framework_script = framework_script + "<script></script>";
- } else {
- framework_script =
- framework_script + "<script src=\"" + rootPathUri + "/"
- + framework.getPath() + "\"";
- if (framework.getParam2() != null && !framework.getParam2().isEmpty()) {
- String param = new String(framework.getParam2());
- param = makeParamString(param);
- framework_script = framework_script + param;
- }
- framework_script = framework_script + "></script>";
- }
- }
- }
-
- String metaTag = new String("");
- for (Meta meta : mAppManager.getAppFileData().getMetas()) {
- if (!metaTag.isEmpty()) {
- metaTag = metaTag + "\n";
- }
- metaTag = metaTag + "<meta";
- if (meta.getParam() != null && !meta.getParam().isEmpty()) {
- String param = new String(meta.getParam());
- param = makeParamString(param);
- metaTag = metaTag + " " + param;
- }
- if (meta.getParam2() != null && !meta.getParam2().isEmpty()) {
- String param = new String(meta.getParam2());
- param = makeParamString(param);
- metaTag = metaTag + " " + param;
- }
- metaTag = metaTag + ">";
- }
-
- String styleTag = new String("");
- for (Stylesheet style : mAppManager.getAppFileData().getStylesheets()) {
- if (!styleTag.isEmpty()) {
- styleTag = styleTag + "\n";
- }
-
- styleTag =
- styleTag + "<link rel=\"stylesheet\" type=\"text/css\" href=\""
- + rootPathUri + "/";
- if (style.getParam() != null && !style.getParam().isEmpty()) {
- String param = new String(style.getParam());
- param = makeParamString(param);
- styleTag = styleTag + param;
- }
- styleTag = styleTag + "\"";
-
- if (style.getParam2() != null && !style.getParam2().isEmpty()) {
- String param = new String(style.getParam2());
- param = makeParamString(param);
- styleTag = styleTag + " " + param;
- }
-
- styleTag = styleTag + ">";
- }
-
- html = html.replace("%meta%", metaTag);
- html = html.replace("%framework%", framework_script);
- html = html.replace("%style%", styleTag);
-
- html = html.replace("%framwork_theme%", theme);
- html = html.replace("%framwork_scale%", scale);
- html = html.replace("%tool_path%", mNScreenPageModel.getToolPathUri());
- html =
- html.replace("%page_css_path%", rootPathUri + "/"
- + mNScreenPageModel.getPageData().getCssPath());
- html = html.replace("%css%", css);
- html = html.replace("%html%", body);
- } else {
- // do nothing
- }
-
- if (scale.equals("device-width")) {
- browserWidth = 360;
- browserHeight = 640;
- } else if (scale.equals("screen-width")) {
- browserWidth = 720;
- browserHeight = 1280;
- } else if (scale.equals("720")) {
- browserWidth = 720;
- browserHeight = 1280;
- } else if (scale.equals("480")) {
- browserWidth = 480;
- browserHeight = 800;
- }
- recalBrowserArea();
- mImageBufferedBrowserWidget.setHtml(html, pagePathUri);
- }
-}
import java.util.List;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.IActionBars;
import org.eclipse.ui.part.Page;
import org.tizen.webuibuilder.model.nscreen.NScreenModel;
-import org.tizen.webuibuilder.model.nscreen.NScreenModel.NScreenType;
import org.tizen.webuibuilder.ui.views.nscreen.model.NScreenPageModel;
*/
public class NScreenPage extends Page {
private final NScreenPageModel mNScreenPageModel;
-
- private Action mActionTizenWVGA;
- private Action mActionTizenHD;
- private Action mActionWVGA;
- private Action mActionWVGAL;
- private Action mActionHD;
- private Action mActionHDL;
- private Action mActionCustom;
- private NScreenList mNScreenList;
private NScreenBaseComposite mParentComposite;
- class NScrrenAction extends Action {
- private String mTitle;
- private int mWidth;
- private int mHeight;
- private String mCssFileName;
-
- public NScrrenAction(String actionName, String title, int width, int height,
- String cssFileName) {
- mTitle = title;
- mWidth = width;
- mHeight = height;
- mCssFileName = cssFileName + ".css";
-
- this.setText(actionName);
- }
-
- @Override
- public void run() {
- if (existNscreen(mWidth)) {
- showAlreadyExistsDialog();
- return;
- }
- addNewNscreen(mTitle, mWidth, mHeight, mCssFileName, false);
- }
- }
-
- private void makeActions() {
- String templateText = NScreenViewMessages.ACTION_TIZEN_320;
- int width = Integer.parseInt(NScreenViewMessages.TIZEN_320_WIDTH);
- int height = Integer.parseInt(NScreenViewMessages.TIZEN_320_HEIGHT);
- mActionTizenWVGA =
- new NScrrenAction(templateText, templateText, width, height, templateText);
-
- templateText = NScreenViewMessages.ACTION_TIZEN_360;
- width = Integer.parseInt(NScreenViewMessages.TIZEN_360_WIDTH);
- height = Integer.parseInt(NScreenViewMessages.TIZEN_360_HEIGHT);
- mActionTizenHD = new NScrrenAction(templateText, templateText, width, height, templateText);
-
- templateText = NScreenViewMessages.ACTION_WVGA;
- width = Integer.parseInt(NScreenViewMessages.WVGA_WIDTH);
- height = Integer.parseInt(NScreenViewMessages.WVGA_HEIGHT);
- mActionWVGA = new NScrrenAction(templateText, templateText, width, height, templateText);
-
- templateText = NScreenViewMessages.ACTION_HD;
- width = Integer.parseInt(NScreenViewMessages.HD_WIDTH);
- height = Integer.parseInt(NScreenViewMessages.HD_HEIGHT);
- mActionHD = new NScrrenAction(templateText, templateText, width, height, templateText);
-
- templateText = NScreenViewMessages.ACTION_WVGA_LAND;
- width = Integer.parseInt(NScreenViewMessages.WVGA_HEIGHT);
- height = Integer.parseInt(NScreenViewMessages.WVGA_WIDTH);
- mActionWVGAL = new NScrrenAction(templateText, templateText, width, height, templateText);
-
- templateText = NScreenViewMessages.ACTION_HD_LAND;
- width = Integer.parseInt(NScreenViewMessages.HD_HEIGHT);
- height = Integer.parseInt(NScreenViewMessages.HD_WIDTH);
- mActionHDL = new NScrrenAction(templateText, templateText, width, height, templateText);
-
- mActionCustom = new Action() {
- @Override
- public void run() {
- NScreenCustomDialog dialog =
- new NScreenCustomDialog(mParentComposite.getShell(), NScreenPage.this, null);
- dialog.open();
- }
- };
- mActionCustom.setText(NScreenViewMessages.ACTION_CUSTOM);
- mActionCustom.setEnabled(true);
-
- }
-
- private void showInfomationDialog(String message) {
- MessageDialog dialog =
- new MessageDialog(mParentComposite.getShell(),
- NScreenViewMessages.LABEL_INFORMATION, null, message,
- MessageDialog.INFORMATION,
- new String[] { NScreenViewMessages.LABEL_OK }, 0);
- dialog.open();
- }
-
- private void showAlreadyExistsDialog() {
- MessageDialog dialog =
- new MessageDialog(mParentComposite.getShell(),
- NScreenViewMessages.LABEL_INFORMATION, null,
- NScreenViewMessages.LABEL_ALREADY_EXISTS,
- MessageDialog.INFORMATION,
- new String[] { NScreenViewMessages.LABEL_OK }, 0);
- dialog.open();
- }
-
public boolean existNscreen(int width) {
List<NScreenModel> list =
mNScreenPageModel.getAppManager().getNScreenModelManger().getNScreenModels();
return false;
}
- /**
- * before calling this method, First, it is possible to confirm whether it is possible to add
- * call existNscreen(int width)
- *
- * @param width
- * @param cssFileName
- * @param isSelected
- */
- public void addNewNscreen(String title, int width, int height, String cssFileName,
- boolean isSelected) {
- // String filePath = mNScreenPageModel.getAppManager().getCssFolder();
- //
- // File newCSSFile = new File(filePath + IPath.SEPARATOR + cssFileName);
- // String cssFileFullPath = newCSSFile.getAbsolutePath();
-
- NScreenModel model = new NScreenModel(title, NScreenType.CUSTOM);
- model.setDeviceWidth(width);
- model.setDeviceHeight(height);
- model.setFileName(cssFileName);
-
- Command command =
- new NScreenAddCommand(mNScreenPageModel.getAppManager().getNScreenModelManger()
- .getNScreenModels(), model, mNScreenList);
- mNScreenPageModel.getPageDesigner().getCommandStack().execute(command);
- }
-
- public void customScreenDialogAddEdit(NScreenListItem item) {
- if (item == null) {
- mActionCustom.run();
- } else {
- NScreenCustomDialog dialog =
- new NScreenCustomDialog(mParentComposite.getShell(), NScreenPage.this, item);
- dialog.open();
- }
- }
-
- public void deleteNScreen(NScreenListItem item) {
- List<NScreenModel> list =
- mNScreenPageModel.getAppManager().getNScreenModelManger().getNScreenModels();
- if (list.get(0) == item.getModel()) {
- showInfomationDialog("can not delete the default screen.");
- return;
- }
- mNScreenList.defaultSelected();
- Command command = new NScreenDeleteCommand(list, item, mNScreenList);
- mNScreenPageModel.getPageDesigner().getCommandStack().execute(command);
- }
-
- private void contributeToActionBars() {
- IActionBars bars = getSite().getActionBars();
- IMenuManager manager = bars.getMenuManager();
-
- manager.add(mActionTizenWVGA);
- manager.add(mActionTizenHD);
-
- manager.add(new Separator());
-
- manager.add(mActionWVGA);
- manager.add(mActionHD);
-
- manager.add(new Separator());
-
- manager.add(mActionWVGAL);
- manager.add(mActionHDL);
-
- manager.add(new Separator());
-
- manager.add(mActionCustom);
-
- }
-
public NScreenPage(NScreenPageModel nScreenPageModel) {
mNScreenPageModel = nScreenPageModel;
mNScreenPageModel.setNScreenPage(this);
import java.util.List;
import org.eclipse.gef.commands.Command;
-import org.eclipse.swt.SWT;
import org.tizen.webuibuilder.ui.views.nscreen.NScreenGroup;
import org.tizen.webuibuilder.ui.views.nscreen.NScreenItem;
+++ /dev/null
-
-
-package org.tizen.webuibuilder.ui.views.nscreen;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.swt.widgets.Shell;
-
-
-public class testcode {
-
- public static void main(String[] args) {
- Display display = new Display();
- Shell shell = new Shell(display);
- Composite composite = new Composite(shell, SWT.BORDER);
- composite.addListener(SWT.MouseDown | SWT.MouseUp, new Listener() {
-
- @Override
- public void handleEvent(Event event) {
- System.out.println("mouse up/down");
-
- }
- });
- Rectangle clientArea = shell.getClientArea();
- composite.setBounds(clientArea.x, clientArea.y, 100, 100);
- Menu menu = new Menu(shell, SWT.POP_UP);
- MenuItem item1 = new MenuItem(menu, SWT.PUSH);
- item1.setText("test");
- composite.setMenu(menu);
- shell.setMenu(menu);
- shell.setSize(300, 300);
- shell.open();
- while (!shell.isDisposed()) {
- if (!display.readAndDispatch())
- display.sleep();
- }
- display.dispose();
- }
-}