Author: yradtsevich
Date: 2012-03-15 10:24:59 -0400 (Thu, 15 Mar 2012)
New Revision: 39535
Added:
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/page-title-background.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/IOSPageTitleStyledText.java
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/BrowserSim.java
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/AppleIPhone3Skin.java
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/BrowserSimSkin.java
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/NativeSkin.java
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/AppleIPhone3ResizableSkin.java
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/AppleIPhoneComposite.java
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/IOSNavBarComposite.java
Log:
https://issues.jboss.org/browse/JBIDE-11191 : BrowserSim Web Page Title - should change to
the <title></title>
Added:
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/page-title-background.png
===================================================================
(Binary files differ)
Property changes on:
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/page-title-background.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/BrowserSim.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/BrowserSim.java 2012-03-15
14:22:02 UTC (rev 39534)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/BrowserSim.java 2012-03-15
14:24:59 UTC (rev 39535)
@@ -28,6 +28,8 @@
import org.eclipse.swt.browser.ProgressListener;
import org.eclipse.swt.browser.StatusTextEvent;
import org.eclipse.swt.browser.StatusTextListener;
+import org.eclipse.swt.browser.TitleEvent;
+import org.eclipse.swt.browser.TitleListener;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.MenuAdapter;
@@ -247,6 +249,13 @@
skin.setAddressBarVisible(true);
}
});
+
+ browser.addTitleListener(new TitleListener() {
+ @Override
+ public void changed(TitleEvent event) {
+ skin.pageTitleChanged(event.title);
+ }
+ });
}
private void setShellAttibutes() {
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/AppleIPhone3Skin.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/AppleIPhone3Skin.java 2012-03-15
14:22:02 UTC (rev 39534)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/AppleIPhone3Skin.java 2012-03-15
14:24:59 UTC (rev 39535)
@@ -366,5 +366,10 @@
public void setContextMenu(Menu contextMenu) {
shell.setMenu(contextMenu);
}
+
+ @Override
+ public void pageTitleChanged(String newTitle) {
+ // not supported
+ }
}
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/BrowserSimSkin.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/BrowserSimSkin.java 2012-03-15
14:22:02 UTC (rev 39534)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/BrowserSimSkin.java 2012-03-15
14:24:59 UTC (rev 39535)
@@ -30,6 +30,7 @@
void setControlHandler(ControlHandler controlHandler);
void locationChanged(String newLocation, boolean backEnabled, boolean forwardEnabled);
+ void pageTitleChanged(String newTitle);
void progressChanged(int percents); // -1 for completed
void statusTextChanged(String newStatusText);
void setOrientationAndSize(Point maximumShellSize, int orientation, Point browserSize);
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/NativeSkin.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/NativeSkin.java 2012-03-15
14:22:02 UTC (rev 39534)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/NativeSkin.java 2012-03-15
14:24:59 UTC (rev 39535)
@@ -284,6 +284,11 @@
}
@Override
+ public void pageTitleChanged(String newTitle) {
+ // not supported
+ }
+
+ @Override
public void statusTextChanged(String statusText) {
statusLabel.setText(statusText);
}
@@ -297,4 +302,5 @@
public void setContextMenu(Menu contextMenu) {
// not supported
}
+
}
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/AppleIPhone3ResizableSkin.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/AppleIPhone3ResizableSkin.java 2012-03-15
14:22:02 UTC (rev 39534)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/AppleIPhone3ResizableSkin.java 2012-03-15
14:24:59 UTC (rev 39535)
@@ -5,9 +5,6 @@
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Region;
import org.eclipse.swt.layout.FillLayout;
@@ -284,8 +281,14 @@
iPhoneComposite.getBackButtonComposite().setEnabled(backEnabled);
iPhoneComposite.getForwardButtonComposite().setEnabled(forwardEnabled);
}
+
@Override
+ public void pageTitleChanged(String newTitle) {
+ iPhoneComposite.getPageTitleStyledText().setText(newTitle);
+ }
+
+ @Override
public void progressChanged(int percents) {
ProgressBar progressBar = iPhoneComposite.getProgressBar();
if (percents > 0) {
@@ -306,6 +309,7 @@
public void setOrientationAndSize(Point maximumShellSize, int orientation, Point
browserSize) {
vertical = (orientation == DeviceOrientation.PORTRAIT || orientation ==
DeviceOrientation.PORTRAIT_INVERTED);
String urlTextText = iPhoneComposite.getUrlText().getText();
+ String pageTitle = iPhoneComposite.getPageTitleStyledText().getText();
boolean backEnabled = iPhoneComposite.getBackButtonComposite().getEnabled();
boolean forwardEnabled = iPhoneComposite.getForwardButtonComposite().getEnabled();
boolean navBarVisible = iPhoneComposite.isNavBarCompositeVisible();
@@ -344,6 +348,7 @@
setShellRegion();
iPhoneComposite.getUrlText().setText(urlTextText);
+ iPhoneComposite.getPageTitleStyledText().setText(pageTitle);
iPhoneComposite.getBackButtonComposite().setEnabled(backEnabled);
iPhoneComposite.getForwardButtonComposite().setEnabled(forwardEnabled);
iPhoneComposite.setNavBarCompositeVisible(navBarVisible);
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/AppleIPhoneComposite.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/AppleIPhoneComposite.java 2012-03-15
14:22:02 UTC (rev 39534)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/AppleIPhoneComposite.java 2012-03-15
14:24:59 UTC (rev 39535)
@@ -1,5 +1,6 @@
package org.jboss.tools.vpe.browsersim.ui.skin.ios;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.layout.FormAttachment;
@@ -148,6 +149,10 @@
return navBarComposite.getProgressBar();
}
+ public StyledText getPageTitleStyledText() {
+ return navBarComposite.getPageTitleStyledText();
+ }
+
@Override
public void addListener(int eventType, Listener listener) {
super.addListener(eventType, listener);
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/IOSNavBarComposite.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/IOSNavBarComposite.java 2012-03-15
14:22:02 UTC (rev 39534)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/IOSNavBarComposite.java 2012-03-15
14:24:59 UTC (rev 39535)
@@ -1,5 +1,6 @@
package org.jboss.tools.vpe.browsersim.ui.skin.ios;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
@@ -20,6 +21,7 @@
private ImageButtonComposite refreshButtonComposite;
private Text urlText;
private ProgressBar progressBar;
+ private StyledText pageTitleStyledText;
/**
* Create the composite.
@@ -31,8 +33,17 @@
this.setLayout(new FormLayout());
+ pageTitleStyledText = new IOSPageTitleStyledText(this, imageList);
+ FormData formData = new FormData();
+ formData.left = new FormAttachment(0, 0);
+ formData.right = new FormAttachment(100, 0);
+ formData.top = new FormAttachment(0, 0);
+ formData.bottom = new FormAttachment(0, 26);
+ formData.height = 27;
+ pageTitleStyledText.setLayoutData(formData);
urlText = new Text(this, SWT.SINGLE);
- FormData formData = new FormData();
+
+ formData = new FormData();
formData.left = new FormAttachment(0, 12);
formData.right = new FormAttachment(100, -62);
formData.top = new FormAttachment(0, 33);
@@ -107,4 +118,8 @@
public ProgressBar getProgressBar() {
return progressBar;
}
+
+ public StyledText getPageTitleStyledText() {
+ return pageTitleStyledText;
+ }
}
Added:
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/IOSPageTitleStyledText.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/IOSPageTitleStyledText.java
(rev 0)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/IOSPageTitleStyledText.java 2012-03-15
14:24:59 UTC (rev 39535)
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2012 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.vpe.browsersim.ui.skin.ios;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Device;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.widgets.Composite;
+import org.jboss.tools.vpe.browsersim.ui.skin.ImageList;
+
+public class IOSPageTitleStyledText extends StyledText {
+ private final String BD = "ios/";
+ private Font font;
+ private Color foregroundColor;
+
+ public IOSPageTitleStyledText(Composite parent, ImageList imageList) {
+ super(parent, SWT.SINGLE | SWT.WRAP);
+ setBackgroundImage(imageList.getImage(BD + "page-title-background.png"));
+ setEditable(false);
+ setEnabled(false);
+ setMargins(16, 6, 16, 0);
+ setAlignment(SWT.CENTER);
+ font = createFont(this.getDisplay(), 9, SWT.BOLD);
+ setFont(font);
+ foregroundColor = new Color(this.getDisplay(), 64, 64, 64);
+ setForeground(foregroundColor);
+ }
+
+ static Font createFont(Device device, int FONT_SIZE, int style) {
+ Font font;
+ if(SWT.getPlatform() == "win32") {
+ font = new Font(device, "Arial", FONT_SIZE, style);
+ } else if (SWT.getPlatform() == "motif") {
+ font = new Font(device, "Times", FONT_SIZE, style);
+ } else if (SWT.getPlatform() == "gtk") {
+ font = new Font(device, "Baekmuk Batang", FONT_SIZE, style);
+ } else if (SWT.getPlatform() == "cocoa") {
+ font = new Font(device, "Helvetica", FONT_SIZE, style);
+ } else { // photon
+ font = new Font(device, "Verdana", FONT_SIZE, style);
+ }
+
+ return font;
+ }
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ font.dispose();
+ foregroundColor.dispose();
+ }
+}