Author: yradtsevich
Date: 2012-01-17 12:59:17 -0500 (Tue, 17 Jan 2012)
New Revision: 37903
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
Log:
https://issues.jboss.org/browse/JBIDE-10656 : BrowserSim: add enabled/disabled state for
the 'back' and 'forward' buttons
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-01-17
17:26:58 UTC (rev 37902)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/BrowserSim.java 2012-01-17
17:59:17 UTC (rev 37903)
@@ -86,6 +86,7 @@
browserSim.initDevicesListHolder();
browserSim.devicesListHolder.setDevicesList(devicesList);
browserSim.devicesListHolder.notifyObservers();
+ browserSim.controlHandler.goHome();
while (browserSim.skin!= null && browserSim.skin.getShell() != null &&
!browserSim.skin.getShell().isDisposed()) {//XXX
if (!display.readAndDispatch())
@@ -177,7 +178,8 @@
browser.addLocationListener(new LocationListener() {
public void changed(LocationEvent event) {
if (event.top) {
- skin.locationChanged(event.location);
+ BrowserSimBrowser browser = (BrowserSimBrowser) event.widget;
+ skin.locationChanged(event.location, browser.isBackEnabled(),
browser.isForwardEnabled());
}
}
public void changing(LocationEvent event) {
@@ -360,9 +362,9 @@
skin.getBrowser().setDefaultUserAgent(device.getUserAgent());
if (oldSkinUrl != null) {
- skin.getBrowser().setUrl(oldSkinUrl);
+ skin.getBrowser().setUrl(oldSkinUrl); // skin (and browser instance) is changed
} else {
- skin.getBrowser().setUrl(homeUrl);
+ skin.getBrowser().refresh(); // only user agent and size of the browser is changed
}
}
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-01-17
17:26:58 UTC (rev 37902)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/AppleIPhone3Skin.java 2012-01-17
17:59:17 UTC (rev 37903)
@@ -361,8 +361,10 @@
}
@Override
- public void locationChanged(String location) {
+ public void locationChanged(String location, boolean backEnabled, boolean
forwardEnabled) {
locationText.setText(location);
+ backCompositeDecorator.setVisible(backEnabled);
+ forwardCompositeDecorator.setVisible(forwardEnabled);
}
@Override
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-01-17
17:26:58 UTC (rev 37902)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/BrowserSimSkin.java 2012-01-17
17:59:17 UTC (rev 37903)
@@ -29,7 +29,7 @@
void setControlHandler(ControlHandler controlHandler);
void setBrowserSize(int width, int height);
- void locationChanged(String newLocation);
+ void locationChanged(String newLocation, boolean backEnabled, boolean forwardEnabled);
void progressChanged(int percents); // -1 for completed
void statusTextChanged(String newStatusText);
void setOrientation(int orientation);
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-01-17
17:26:58 UTC (rev 37902)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/NativeSkin.java 2012-01-17
17:59:17 UTC (rev 37903)
@@ -300,8 +300,10 @@
}
@Override
- public void locationChanged(String location) {
+ public void locationChanged(String location, boolean backEnabled, boolean
forwardEnabled) {
locationText.setText(location);
+ itemBack.setEnabled(backEnabled);
+ itemForward.setEnabled(forwardEnabled);
}
@Override