[Title] Change indentation
authorho.namkoong <ho.namkoong@samsung.com>
Wed, 8 Aug 2012 02:05:42 +0000 (11:05 +0900)
committerho.namkoong <ho.namkoong@samsung.com>
Wed, 8 Aug 2012 02:05:42 +0000 (11:05 +0900)
Change-Id: Ic18e86c2cfbc30424221bfedc54b52264af72b9f

org.tizen.common.externals/src/org/mihalis/opal/preferenceWindow/PWTabContainer.java

index 5092095..94f9d53 100644 (file)
@@ -35,181 +35,181 @@ import org.mihalis.opal.utils.SWTGraphicUtil;
  */\r
 class PWTabContainer extends Composite {\r
 \r
-       private final List<PWTab> tabs;\r
-       private Composite container;\r
-       private Image oldButtonContainerImage;\r
-       private final List<FlatButton> buttons;\r
-       private Composite buttonContainer;\r
-\r
-       /**\r
-        * Constructor\r
-        \r
-        * @param parent parent composite\r
-        * @param style style (not used)\r
-        * @param tabs list of tabs\r
-        */\r
-       PWTabContainer(final Composite parent, final int style, final List<PWTab> tabs) {\r
-               super(parent, style);\r
-               this.tabs = new ArrayList<PWTab>();\r
-               this.tabs.addAll(tabs);\r
-\r
-               this.buttons = new ArrayList<FlatButton>();\r
-\r
-               final GridLayout gridLayout = new GridLayout(2, false);\r
-               gridLayout.marginWidth = gridLayout.marginHeight = 0;\r
-               gridLayout.horizontalSpacing = gridLayout.verticalSpacing = 0;\r
-               setLayout(gridLayout);\r
-\r
-       }\r
-\r
-       /**\r
-        * Build the container\r
-        */\r
-       void build() {\r
-               createButtonsContainer();\r
-               createButtons();\r
-               createContentContainer();\r
-\r
-               select(0);\r
-       }\r
-\r
-       /**\r
-        * Create the buttons container\r
-        */\r
-       private void createButtonsContainer() {\r
-               createContainer();\r
-               createButtonsContainerBackground();\r
-\r
-       }\r
-\r
-       /**\r
-        * Create the container\r
-        */\r
-       private void createContainer() {\r
-               this.buttonContainer = new Composite(this, SWT.NONE);\r
-               final GridData buttonContainerGridData = new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1);\r
-               //buttonContainerGridData.heightHint = 63; // Original size (32x32)\r
-               //buttonContainerGridData.heightHint = 79; // Tizen fit size (48x48)\r
-               this.buttonContainer.setLayoutData(buttonContainerGridData);\r
-\r
-               this.buttonContainer.setBackground(getDisplay().getSystemColor(SWT.COLOR_WHITE));\r
-\r
-               final GridLayout gridLayout = new GridLayout(this.tabs.size(), false);\r
-               gridLayout.marginWidth = gridLayout.marginHeight = 0;\r
-               gridLayout.horizontalSpacing = gridLayout.verticalSpacing = 0;\r
-               gridLayout.marginBottom = 2;\r
-               this.buttonContainer.setLayout(gridLayout);\r
-       }\r
-\r
-       /**\r
-        * Create the background of the container\r
-        */\r
-       private void createButtonsContainerBackground() {\r
-               this.buttonContainer.addListener(SWT.Resize, new Listener() {\r
-\r
-                       @Override\r
-                       public void handleEvent(final Event event) {\r
-                               final Rectangle rect = PWTabContainer.this.buttonContainer.getClientArea();\r
-                               final Image image = new Image(getDisplay(), Math.max(1, rect.width), Math.max(1, rect.height));\r
-                               final GC gc = new GC(image);\r
-                               final Color grey = new Color(getDisplay(), 204, 204, 204);\r
-                               gc.setForeground(grey);\r
-                               gc.drawLine(0, rect.height - 1, rect.width, rect.height - 1);\r
-                               grey.dispose();\r
-                               gc.dispose();\r
-                               PWTabContainer.this.buttonContainer.setBackgroundImage(image);\r
-                               if (PWTabContainer.this.oldButtonContainerImage != null) {\r
-                                       PWTabContainer.this.oldButtonContainerImage.dispose();\r
-                               }\r
-                               PWTabContainer.this.oldButtonContainerImage = image;\r
-\r
-                       }\r
-               });\r
-               SWTGraphicUtil.dispose(this.buttonContainer, this.oldButtonContainerImage);\r
-       }\r
-\r
-       /**\r
-        * Create the buttons\r
-        */\r
-       private void createButtons() {\r
-               for (int i = 0; i < this.tabs.size(); i++) {\r
-                       final PWTab tab = this.tabs.get(i);\r
-                       final FlatButton button = new FlatButton(this.buttonContainer, SWT.NONE);\r
-                       button.setText(tab.getText());\r
-                       button.setImage(tab.getImage());\r
-                       SWTGraphicUtil.dispose(button, tab.getImage());\r
-\r
-                       final GridData gd;\r
-                       if (i == this.tabs.size() - 1) {\r
-                               gd = new GridData(GridData.BEGINNING, GridData.BEGINNING, true, false);\r
-                       } else {\r
-                               gd = new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false);\r
-                       }\r
-                       if (i == 0) {\r
-                               gd.horizontalIndent = 5;\r
-                       }\r
-                       gd.widthHint = 75;\r
-                       button.setLayoutData(gd);\r
-\r
-                       final int index = i;\r
-                       button.addSelectionListener(new SelectionAdapter() {\r
-\r
-                               /**\r
-                                * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)\r
-                                */\r
-                               @Override\r
-                               public void widgetSelected(final SelectionEvent e) {\r
-                                       select(index);\r
-                               }\r
-\r
-                       });\r
-\r
-                       this.buttons.add(button);\r
-\r
-               }\r
-       }\r
-\r
-       /**\r
-        * Select a given button\r
-        \r
-        * @param index index of the selected button\r
-        */\r
-       private void select(final int index) {\r
-               for (final Control c : this.container.getChildren()) {\r
-                       c.dispose();\r
-               }\r
-\r
-               this.tabs.get(index).build(this.container);\r
-               this.container.layout();\r
-\r
-               for (int i = 0; i < this.buttons.size(); i++) {\r
-                       this.buttons.get(i).setSelection(i == index);\r
-               }\r
-       }\r
-\r
-       /**\r
-        * Create the content container, ie the composite that will contain all\r
-        * widgets\r
-        */\r
-       private void createContentContainer() {\r
-               this.container = new Composite(this, SWT.NONE);\r
-               final GridData tempContainer = new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1);\r
-               \r
-               int defaultSize = 350;\r
-               int notebookSize = 280;\r
-               \r
-               //tempContainer.widthHint = 700;\r
-               tempContainer.heightHint = defaultSize;\r
-               \r
-               Rectangle bounds = Display.getCurrent().getBounds();\r
-               if (bounds.height <= (768 + defaultSize - notebookSize)) {\r
-                   tempContainer.heightHint = notebookSize; // 280px is fitted on 768px display\r
-               }\r
-               \r
-               this.container.setLayoutData(tempContainer);\r
-       }\r
-\r
-       public Composite getContainer() {\r
-           return this.container;\r
-       }\r
+    private final List<PWTab> tabs;\r
+    private Composite container;\r
+    private Image oldButtonContainerImage;\r
+    private final List<FlatButton> buttons;\r
+    private Composite buttonContainer;\r
+\r
+    /**\r
+     * Constructor\r
+     * \r
+     * @param parent parent composite\r
+     * @param style style (not used)\r
+     * @param tabs list of tabs\r
+     */\r
+    PWTabContainer(final Composite parent, final int style, final List<PWTab> tabs) {\r
+        super(parent, style);\r
+        this.tabs = new ArrayList<PWTab>();\r
+        this.tabs.addAll(tabs);\r
+\r
+        this.buttons = new ArrayList<FlatButton>();\r
+\r
+        final GridLayout gridLayout = new GridLayout(2, false);\r
+        gridLayout.marginWidth = gridLayout.marginHeight = 0;\r
+        gridLayout.horizontalSpacing = gridLayout.verticalSpacing = 0;\r
+        setLayout(gridLayout);\r
+\r
+    }\r
+\r
+    /**\r
+     * Build the container\r
+     */\r
+    void build() {\r
+        createButtonsContainer();\r
+        createButtons();\r
+        createContentContainer();\r
+\r
+        select(0);\r
+    }\r
+\r
+    /**\r
+     * Create the buttons container\r
+     */\r
+    private void createButtonsContainer() {\r
+        createContainer();\r
+        createButtonsContainerBackground();\r
+\r
+    }\r
+\r
+    /**\r
+     * Create the container\r
+     */\r
+    private void createContainer() {\r
+        this.buttonContainer = new Composite(this, SWT.NONE);\r
+        final GridData buttonContainerGridData = new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1);\r
+        //buttonContainerGridData.heightHint = 63; // Original size (32x32)\r
+        //buttonContainerGridData.heightHint = 79; // Tizen fit size (48x48)\r
+        this.buttonContainer.setLayoutData(buttonContainerGridData);\r
+\r
+        this.buttonContainer.setBackground(getDisplay().getSystemColor(SWT.COLOR_WHITE));\r
+\r
+        final GridLayout gridLayout = new GridLayout(this.tabs.size(), false);\r
+        gridLayout.marginWidth = gridLayout.marginHeight = 0;\r
+        gridLayout.horizontalSpacing = gridLayout.verticalSpacing = 0;\r
+        gridLayout.marginBottom = 2;\r
+        this.buttonContainer.setLayout(gridLayout);\r
+    }\r
+\r
+    /**\r
+     * Create the background of the container\r
+     */\r
+    private void createButtonsContainerBackground() {\r
+        this.buttonContainer.addListener(SWT.Resize, new Listener() {\r
+\r
+            @Override\r
+            public void handleEvent(final Event event) {\r
+                final Rectangle rect = PWTabContainer.this.buttonContainer.getClientArea();\r
+                final Image image = new Image(getDisplay(), Math.max(1, rect.width), Math.max(1, rect.height));\r
+                final GC gc = new GC(image);\r
+                final Color grey = new Color(getDisplay(), 204, 204, 204);\r
+                gc.setForeground(grey);\r
+                gc.drawLine(0, rect.height - 1, rect.width, rect.height - 1);\r
+                grey.dispose();\r
+                gc.dispose();\r
+                PWTabContainer.this.buttonContainer.setBackgroundImage(image);\r
+                if (PWTabContainer.this.oldButtonContainerImage != null) {\r
+                    PWTabContainer.this.oldButtonContainerImage.dispose();\r
+                }\r
+                PWTabContainer.this.oldButtonContainerImage = image;\r
+\r
+            }\r
+        });\r
+        SWTGraphicUtil.dispose(this.buttonContainer, this.oldButtonContainerImage);\r
+    }\r
+\r
+    /**\r
+     * Create the buttons\r
+     */\r
+    private void createButtons() {\r
+        for (int i = 0; i < this.tabs.size(); i++) {\r
+            final PWTab tab = this.tabs.get(i);\r
+            final FlatButton button = new FlatButton(this.buttonContainer, SWT.NONE);\r
+            button.setText(tab.getText());\r
+            button.setImage(tab.getImage());\r
+            SWTGraphicUtil.dispose(button, tab.getImage());\r
+\r
+            final GridData gd;\r
+            if (i == this.tabs.size() - 1) {\r
+                gd = new GridData(GridData.BEGINNING, GridData.BEGINNING, true, false);\r
+            } else {\r
+                gd = new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false);\r
+            }\r
+            if (i == 0) {\r
+                gd.horizontalIndent = 5;\r
+            }\r
+            gd.widthHint = 75;\r
+            button.setLayoutData(gd);\r
+\r
+            final int index = i;\r
+            button.addSelectionListener(new SelectionAdapter() {\r
+\r
+                /**\r
+                 * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)\r
+                 */\r
+                @Override\r
+                public void widgetSelected(final SelectionEvent e) {\r
+                    select(index);\r
+                }\r
+\r
+            });\r
+\r
+            this.buttons.add(button);\r
+\r
+        }\r
+    }\r
+\r
+    /**\r
+     * Select a given button\r
+     * \r
+     * @param index index of the selected button\r
+     */\r
+    private void select(final int index) {\r
+        for (final Control c : this.container.getChildren()) {\r
+            c.dispose();\r
+        }\r
+\r
+        this.tabs.get(index).build(this.container);\r
+        this.container.layout();\r
+\r
+        for (int i = 0; i < this.buttons.size(); i++) {\r
+            this.buttons.get(i).setSelection(i == index);\r
+        }\r
+    }\r
+\r
+    /**\r
+     * Create the content container, ie the composite that will contain all\r
+     * widgets\r
+     */\r
+    private void createContentContainer() {\r
+        this.container = new Composite(this, SWT.NONE);\r
+        final GridData tempContainer = new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1);\r
+        \r
+        int defaultSize = 350;\r
+        int notebookSize = 280;\r
+        \r
+        //tempContainer.widthHint = 700;\r
+        tempContainer.heightHint = defaultSize;\r
+        \r
+        Rectangle bounds = Display.getCurrent().getBounds();\r
+        if (bounds.height <= (768 + defaultSize - notebookSize)) {\r
+            tempContainer.heightHint = notebookSize; // 280px is fitted on 768px display\r
+        }\r
+        \r
+        this.container.setLayoutData(tempContainer);\r
+    }\r
+\r
+    public Composite getContainer() {\r
+        return this.container;\r
+    }\r
 }\r