You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ca...@apache.org on 2020/03/03 15:00:00 UTC

[royale-asjs] branch develop updated: jewel-textinput: add TruncateText bead

This is an automated email from the ASF dual-hosted git repository.

carlosrovira pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/develop by this push:
     new 30782da  jewel-textinput: add TruncateText bead
30782da is described below

commit 30782dad5c2c9bc2525e0627eabef1164d5cd3b8
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Tue Mar 3 15:59:50 2020 +0100

    jewel-textinput: add TruncateText bead
---
 .../projects/Jewel/src/main/resources/defaults.css |  4 ++
 .../Jewel/src/main/resources/jewel-manifest.xml    |  1 +
 .../jewel/beads/controls/textinput/TruncateText.as | 62 ++++++++++++++++++++++
 .../Jewel/src/main/sass/components/_textinput.sass |  4 ++
 4 files changed, 71 insertions(+)

diff --git a/frameworks/projects/Jewel/src/main/resources/defaults.css b/frameworks/projects/Jewel/src/main/resources/defaults.css
index 35c5b82..850f00d 100644
--- a/frameworks/projects/Jewel/src/main/resources/defaults.css
+++ b/frameworks/projects/Jewel/src/main/resources/defaults.css
@@ -3914,6 +3914,10 @@ j|TableRow {
   left: auto;
   right: 0.45em;
 }
+.jewel.textinput.truncate input {
+  overflow: hidden;
+  text-overflow: ellipsis;
+}
 
 j|TextInput {
   IBeadModel: ClassReference("org.apache.royale.jewel.beads.models.TextModel");
diff --git a/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml b/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
index a0d9a56..18d6084 100644
--- a/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
+++ b/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
@@ -183,6 +183,7 @@
     <component id="UpperCase" class="org.apache.royale.jewel.beads.controls.textinput.UpperCase"/>
     <component id="SearchFilterForList" class="org.apache.royale.jewel.beads.controls.textinput.SearchFilterForList"/>
     <component id="LowerCase" class="org.apache.royale.jewel.beads.controls.textinput.LowerCase"/>
+    <component id="TruncateText" class="org.apache.royale.jewel.beads.controls.textinput.TruncateText"/>
     <component id="ComboUpperCase" class="org.apache.royale.jewel.beads.controls.combobox.ComboUpperCase"/>
     <component id="ComboLowerCase" class="org.apache.royale.jewel.beads.controls.combobox.ComboLowerCase"/>
     <component id="ComboBoxDisabled" class="org.apache.royale.jewel.beads.controls.combobox.ComboBoxDisabled"/>
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/textinput/TruncateText.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/textinput/TruncateText.as
new file mode 100644
index 0000000..2df106c
--- /dev/null
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/textinput/TruncateText.as
@@ -0,0 +1,62 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.royale.jewel.beads.controls.textinput
+{
+	import org.apache.royale.core.IBead;
+	import org.apache.royale.core.IStrand;
+	import org.apache.royale.core.IStyledUIBase;
+	
+	/**
+	 *  The TruncateText class is a specialty bead that can be used with
+	 *  a Jewel TextInputBase control. The bead truncate the text when no space is available
+	 *  using "..."
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion Royale 0.9.7
+	 */
+	public class TruncateText implements IBead
+	{
+		/**
+		 *  constructor.
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion Royale 0.9.7
+		 */
+		public function TruncateText()
+		{
+		}
+
+		/**
+		 *  @copy org.apache.royale.core.IBead#strand
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion Royale 0.9.7
+		 */
+		public function set strand(value:IStrand):void
+		{
+			(value as IStyledUIBase).addClass("truncate");
+		}
+	}
+}
diff --git a/frameworks/projects/Jewel/src/main/sass/components/_textinput.sass b/frameworks/projects/Jewel/src/main/sass/components/_textinput.sass
index d5c1fe0..9e53812 100644
--- a/frameworks/projects/Jewel/src/main/sass/components/_textinput.sass
+++ b/frameworks/projects/Jewel/src/main/sass/components/_textinput.sass
@@ -73,6 +73,10 @@ $textinput-padding-horizontal: 1.12em !default
 						left: auto
 						right: .45em
 
+		&.truncate
+			input
+				overflow: hidden
+				text-overflow: ellipsis
 
 j|TextInput
 	IBeadModel: ClassReference("org.apache.royale.jewel.beads.models.TextModel")