Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » AbstractTool[Form]Button doesn't show
AbstractTool[Form]Button doesn't show [message #1068039] Thu, 11 July 2013 19:11 Go to next message
Boy D'Poy is currently offline Boy D'Poy
Messages: 56
Registered: October 2011
Member
Hi everyone!

I followed the example as described here (http://wiki.eclipse.org/Scout/Concepts/ToolButton) (i did not forget to select the Rayo thechnology!)in the SDK but at runtime, I have no ToolButton displayed at the right top corner of the UI (not in Swing nor In RAP) as in the Scoot Book (http://tools.bsiag.com/scoutbook/3.9/latest/pdf/book.pdf / Page #14). ;(

Is there something missing in the code below?


package zzz.zzz.zzz.client.ui.desktop;

import org.eclipse.scout.commons.annotations.Order;
import org.eclipse.scout.commons.exception.ProcessingException;
import org.eclipse.scout.commons.logger.IScoutLogger;
import org.eclipse.scout.commons.logger.ScoutLogManager;
import org.eclipse.scout.rt.client.ClientJob;
import org.eclipse.scout.rt.client.ui.action.keystroke.AbstractKeyStroke;
import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
import org.eclipse.scout.rt.client.ui.action.tool.AbstractToolButton;
import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
import org.eclipse.scout.rt.client.ui.desktop.bookmark.menu.AbstractBookmarkMenu;
import org.eclipse.scout.rt.client.ui.desktop.outline.AbstractOutlineViewButton;
import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
import org.eclipse.scout.rt.client.ui.form.ScoutInfoForm;
import org.eclipse.scout.rt.client.ui.form.outline.DefaultOutlineTableForm;
import org.eclipse.scout.rt.client.ui.form.outline.DefaultOutlineTreeForm;
import org.eclipse.scout.rt.extension.client.ui.desktop.AbstractExtensibleDesktop;
import org.eclipse.scout.rt.shared.AbstractIcons;
import org.eclipse.scout.rt.shared.TEXTS;
import org.eclipse.scout.rt.shared.ui.UserAgentUtility;

import zzz.zzz.zzz.client.ClientSession;
import zzz.zzz.zzz.client.ui.desktop.outlines.StandardOutline;

public class Desktop extends AbstractExtensibleDesktop implements IDesktop {
	
	@Order(25)
	public class BookmarkMenu extends AbstractBookmarkMenu {
		
		public BookmarkMenu() {
		
			super(Desktop.this);
		}
	}
	
	@Order(10.0)
	public class FileMenu extends AbstractMenu {
		
		@Order(100.0)
		public class ExitMenu extends AbstractMenu {
			
			@Override
			public void execAction() throws ProcessingException {
			
				ClientJob.getCurrentSession(ClientSession.class).stopSession();
			}
			
			@Override
			protected String getConfiguredText() {
			
				return TEXTS.get("ExitMenu");
			}
		}
		
		@Override
		protected String getConfiguredText() {
		
			return TEXTS.get("FileMenu");
		}
	}
	
	@Order(30.0)
	public class HelpMenu extends AbstractMenu {
		
		@Order(10.0)
		public class AboutMenu extends AbstractMenu {
			
			@Override
			public void execAction() throws ProcessingException {
			
				final ScoutInfoForm form = new ScoutInfoForm();
				form.startModify();
			}
			
			@Override
			protected String getConfiguredText() {
			
				return TEXTS.get("AboutMenu");
			}
		}
		
		@Override
		protected String getConfiguredText() {
		
			return TEXTS.get("HelpMenu");
		}
	}
	
	@Order(10.0)
	public class RefreshOutlineKeyStroke extends AbstractKeyStroke {
		
		@Override
		protected void execAction() throws ProcessingException {
		
			if (Desktop.this.getOutline() != null) {
				final IPage page = Desktop.this.getOutline().getActivePage();
				if (page != null) {
					page.reloadPage();
				}
			}
		}
		
		@Override
		protected String getConfiguredKeyStroke() {
		
			return "f5";
		}
	}
	
	@Order(10.0)
	public class SampleButtonTool extends AbstractToolButton {
		
		@Override
		protected String getConfiguredIconId() {
		
			return AbstractIcons.TreeNodeOpen;
		}
		
		@Override
		protected String getConfiguredText() {
		
			return TEXTS.get("WizardBackButton");
		}
	}
	
	@Order(10.0)
	public class StandardOutlineViewButton extends AbstractOutlineViewButton {
		
		public StandardOutlineViewButton() {
		
			super(Desktop.this, StandardOutline.class);
		}
		
		@Override
		protected String getConfiguredText() {
		
			return TEXTS.get("StandardOutline");
		}
	}
	
	@Order(20.0)
	public class ToolsMenu extends AbstractMenu {
		
		@Override
		protected String getConfiguredText() {
		
			return TEXTS.get("ToolsMenu");
		}
	}
	
	private static IScoutLogger logger = ScoutLogManager.getLogger(Desktop.class);
	
	public Desktop() {
	
	}
	
	@Override
	protected void execOpened() throws ProcessingException {
	
		// If it is a mobile or tablet device, the DesktopExtension in the mobile plugin takes care of starting the correct forms.
		if (!UserAgentUtility.isDesktopDevice()) { return; }
		// outline tree
		final DefaultOutlineTreeForm treeForm = new DefaultOutlineTreeForm();
		treeForm.startView();
		// outline table
		final DefaultOutlineTableForm tableForm = new DefaultOutlineTableForm();
		tableForm.startView();
		if (this.getAvailableOutlines().length > 0) {
			this.setOutline(this.getAvailableOutlines()[0]);
		}
	}
	
	@SuppressWarnings("unchecked")
	@Override
	protected Class<? extends IOutline>[] getConfiguredOutlines() {
	
		return new Class[] { StandardOutline.class };
	}
	
	@Override
	protected String getConfiguredTitle() {
	
		return TEXTS.get("ApplicationTitle");
	}
}



Thank you!


Once You Go Scout, You Never Come Out!
Re: AbstractTool[Form]Button doesn't show [message #1068048 is a reply to message #1068039] Thu, 11 July 2013 19:32 Go to previous messageGo to next message
Boy D'Poy is currently offline Boy D'Poy
Messages: 56
Registered: October 2011
Member
Ok, as told on the tutorial : Quote:
For the moment the normal ToolButtons are not rendered with the Rayo look and feel.


So a choosed tu use the defaut given form I have, I mean the DefaultOutlineTableForm, and transform ToolButton as this:

	@Order(10.0)
	public class SampleButtonTool extends AbstractFormToolButton<DefaultOutlineTableForm> {
		
		@Override
		protected String getConfiguredIconId() {
		
			return AbstractIcons.TreeNodeOpen;
		}
		
		@Override
		protected String getConfiguredText() {
		
			return TEXTS.get("WizardBackButton");
		}
	}


It now renders but still doesn't show the icon, is there something missing?

Thanks!


Once You Go Scout, You Never Come Out!
Re: AbstractTool[Form]Button doesn't show [message #1070651 is a reply to message #1068048] Thu, 18 July 2013 11:55 Go to previous messageGo to next message
Andreas Hoegger is currently offline Andreas Hoegger
Messages: 174
Registered: February 2010
Senior Member
Could you give some detailed information, a screen cast? I tried to rebuild your example with the attached result.

index.php/fa/15629/0/

Seems to work in my case.

-andreas
Re: AbstractTool[Form]Button doesn't show [message #1070759 is a reply to message #1070651] Thu, 18 July 2013 15:51 Go to previous messageGo to next message
Boy D'Poy is currently offline Boy D'Poy
Messages: 56
Registered: October 2011
Member
Hi!

yes, it works on the Swing client as I told above, but not on the Rap client as I expected like what we have on the Scout Book (p. 14)

Below are the screenshots I got!


Once You Go Scout, You Never Come Out!
Re: AbstractTool[Form]Button doesn't show [message #1071087 is a reply to message #1070759] Fri, 19 July 2013 10:16 Go to previous messageGo to next message
Andreas Hoegger is currently offline Andreas Hoegger
Messages: 174
Registered: February 2010
Senior Member
Ok I see.
The buttons in RAP do not support a nice hover, selected and active/inactive behavior. Therefore we decided to use styling capabilities instead of setImage method on RWT buttons.

In your case you have to add the following styling to your application.css (/zzz.zzz.zzz.ui.rap/theme/application.css). Where 'MyToolButton' is the simple class name of your button on the desktop.

 Button.toolButton-MyToolButton {
  padding: 15px 15px;
  background-image: url( theme/img/button/tool/icon_magnifier.png );
}

Button.toolButton-active-MyToolButton:selected {
  background-image: url( theme/img/button/tool/icon_magnifier_active.png );
}

Button.toolButton-active-MyToolButton:selected:hover {
  background-image: url( theme/img/button/tool/icon_magnifier_active.png );
}

Button.toolButton-MyToolButton:hover {
  background-image: url( theme/img/button/tool/icon_magnifier_mouse_over.png );
}

Button.toolButton-MyToolButton:pressed {
  background-image: url( theme/img/button/tool/icon_magnifier_mouse_over.png );
}


-andreas
Re: AbstractTool[Form]Button doesn't show [message #1071273 is a reply to message #1071087] Fri, 19 July 2013 17:53 Go to previous message
Boy D'Poy is currently offline Boy D'Poy
Messages: 56
Registered: October 2011
Member
It works!
Smile
Thank you!


Once You Go Scout, You Never Come Out!
Previous Topic:Scout server and rap client in one product
Next Topic:Setting certain cells in an editable table column to non-editable doesn't work
Goto Forum:
  


Current Time: Mon Oct 20 18:17:11 GMT 2014

Powered by FUDForum. Page generated in 0.12495 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software