Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » Tile Widget Example(unable to reproduce Tile Widget Demo from git)
Tile Widget Example [message #1849483] Fri, 21 January 2022 08:24 Go to next message
Oleg Zhuravlev is currently offline Oleg ZhuravlevFriend
Messages: 8
Registered: January 2022
Junior Member
seriously broke my head trying reproduce Tile Widget Demo from git

Form:
public class ExampleForm extends AbstractForm {
	@Override
	protected int getConfiguredDisplayHint() { 
		return IForm.DISPLAY_HINT_VIEW;
	}
	@Override
	protected String getConfiguredTitle() {
		return TEXTS.get("Product");
	}
	public MainBox getMainBox() {
		return getFieldByClass(MainBox.class);
	}
	public GroupBox getGroupBox() {
		return getFieldByClass(GroupBox.class);
	}
	public TileField getTileField() {
		  return getFieldByClass(TileField.class);
	}	
	
	@Order(1000)
	public class MainBox extends AbstractGroupBox {
		@Order(1000)
		public class GroupBox extends AbstractGroupBox {
			@Order(200)
			public class TileField extends AbstractTileField<TileGrid> {
			    	@Override
			        protected boolean getConfiguredLabelVisible() {
					return false;
		        	}
			        @Override
			        protected int getConfiguredGridW() {
					return FULL_WIDTH;
		        	}

			       public class TileGrid extends AbstractTileGrid<ICustomTile>{
					@Override
					protected int getConfiguredGridColumnCount() {
						return 4;
					}
					
					  public class SimpleTile2 extends AbstractCustomTile {
					  @Override
					  protected String getConfiguredLabel() {
					    return "Tile 2";
					  }
				} // public class TileGrid
			}// public class TileField
		}// public class GroupBox 
	}// public class MainBox 

}//public class ExampleForm 


ICustomTile
public interface ICustomTile extends ITile {

  String PROP_LABEL = "label";

  String getLabel();

  void setLabel(String label);

  String getGroup();

  void setGroup(String group);
}


AbstractCustomTile
public abstract class AbstractCustomTile extends AbstractTile implements ICustomTile {
  private String m_group;

  @Override
  protected void initConfig() {
    super.initConfig();

    setLabel(getConfiguredLabel());
  }

  @Override
  protected String getConfiguredDisplayStyle() {
    return DISPLAY_STYLE_DEFAULT;//DISPLAY_STYLE_PLAIN;
  }

  @ConfigProperty(ConfigProperty.TEXT)
  @Order(10)
  protected String getConfiguredLabel() {
    return null;
  }

  @Override
  public String getLabel() {
    return propertySupport.getPropertyString(PROP_LABEL);
  }

  @Override
  public void setLabel(String label) {
    propertySupport.setProperty(PROP_LABEL, label);
  }

  @Override
  public String getGroup() {
    return m_group;
  }

  @Override
  public void setGroup(String group) {
    m_group = group;
  }
}


the only change - in getConfiguredDisplayStyle - if I set DISPLAY_STYLE_PLAIN, then the tiles are not visible at all. With DISPLAY_STYLE_DEFAULT - tiles visible, but they are empty


|______| not |_Tile 2__| as in Scout widgets demo


what am I doing wrong?
Re: Tile Widget Example [message #1849496 is a reply to message #1849483] Fri, 21 January 2022 17:01 Go to previous messageGo to next message
Claudio Guglielmo is currently offline Claudio GuglielmoFriend
Messages: 259
Registered: March 2010
Senior Member
Hi Oleg,

you need to define how the content should be displayed: https://github.com/bsi-software/org.eclipse.scout.docs/tree/releases/11.0/code/widgets/org.eclipse.scout.widgets.ui.html/src/main/js/tile. Don't forget to register these files in the index-files.

If you don't want to write any JavaScript code you could use IHtmlTile instead.

Best regards
Claudio
Re: Tile Widget Example [message #1849528 is a reply to message #1849496] Mon, 24 January 2022 05:46 Go to previous messageGo to next message
Oleg Zhuravlev is currently offline Oleg ZhuravlevFriend
Messages: 8
Registered: January 2022
Junior Member
Thank you very much, Claudio, it worked with IHtmlTile (and with FormFieldTile with any fields on it too).
I look at js on git, however, can I read somewhere more about js files and their construction /use in this case (and maybe in other situations, for the future)? I didn't find a description of working with js (*.ui.html) anywhere in the documentation. Probably not looking in the right place.
Re: Tile Widget Example [message #1849530 is a reply to message #1849528] Mon, 24 January 2022 08:01 Go to previous messageGo to next message
Claudio Guglielmo is currently offline Claudio GuglielmoFriend
Messages: 259
Registered: March 2010
Senior Member
Hi Oleg,

you will find the documentation of the JavaScript part in the Scout JS technical guide.
Re: Tile Widget Example [message #1849532 is a reply to message #1849528] Mon, 24 January 2022 08:06 Go to previous messageGo to next message
Oleg Zhuravlev is currently offline Oleg ZhuravlevFriend
Messages: 8
Registered: January 2022
Junior Member
I added *.js from git\org.eclipse.scout.widgets.ui.html/src/main/js/tile/ to my example _.ui.html/src/main/js/tile/

in index.js add
export {default as CustomTile} from './tile/CustomTile';
export {default as CustomTileAdapter} from './tile/CustomTileAdapter';

in index.less add
@import "tile/CustomTile";

without any success. I would like, of course, to understand why, but I will not distract you further with this question. Got out of the situation with AbstractFormFieldTile. Everything is fine with him, except for one thing.
I build my tile using the AbstractGroupBox class, where I add everything I need. The only thing, initially, when adding a tile programmatically, I have to refer to:
public static class SimpleTile extends AbstractFormFieldTile<AbstractSlideMainBox>{
	// AbstractSlideMainBox is my GroupBox Class
	public void setSlideName(String slideName) {
		getTileWidget().setLabel(slideName);
	}
	public void SetImageFromURL(String slideURL) {
		getTileWidget().SetImageFromURL(slideURL);
	}

	// and here is the most interesting thing, what I would like to avoid 
	@Order(10)
	public class SlideField extends AbstractSlideMainBox { 
	}
}


This last public class SlideField extends AbstractSlideMainBox{} leads to the appearance :
WARN [scout-model-thread-22 Transforming response to JSON] org.eclipse.scout.rt.client.ui.form.fields.AbstractFormField.classId(AbstractFormField.java:1183) - Found a duplicate classid for SlideField_org.eclipse.scout....ExampleForm, adding field index. Override classId for dynamically injected fields.
as many times as tiles i add. actually, it's understandable why . But would like to know, how to add SlideField to FormFieldTile differently to avoid these warnings.
Something like:
getTileWidget().addField(new AbstractSlideMainBox());
Re: Tile Widget Example [message #1849599 is a reply to message #1849532] Wed, 26 January 2022 14:15 Go to previous message
Oleg Zhuravlev is currently offline Oleg ZhuravlevFriend
Messages: 8
Registered: January 2022
Junior Member
Actually, I had to do without dynamic generation of tiles, and create them in the tilegrid and fill in and hide the extra ones when initializing the form. The option suits me with classic java.
Previous Topic:Problem with running application, Scout 10
Next Topic:DISPLAY_STYLE_BENCH
Goto Forum:
  


Current Time: Fri Dec 06 17:19:30 GMT 2024

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

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

Back to the top