I'm writing an extension to an existing XUL-application, conkeror. In that, In
some part of the user-interface of I'm writing, I'm creating HTML elements with
a fixed-width, <span>s in this case, to display various results.
Within those spans there's text some text, which, on occasion, is too long to
fit its fixed-with container. I'd like to cut-off the parts that are too long,
and end it with an ellipsis instead.
Those spans currently have the following CSS attributes:
display: inline-block;
width: 30%;
overflow: hidden;
white-space: nowrap;
In addition to that, I'd like to use text-overflow: ellipsis;, but it turns
out the Gecko platform doesn't implement that yet. However, for plain HTML pages
with regular style-sheets, there happens to be a workaround for Firefox and
other Gecko-based products, that makes cutting off overlong text and putting an
ellipsis at its end work anyway.
The details of that technique are described
here. It's
using Gecko's ability to run XUL code to do its magic.
So I've tried to use that in my XUL application as well. I've changed my
style-sheet to include the described
-moz-binding: url('ellipsis.xml#ellipsis');, and also created the
elipsis.xml file as described.
However, doing this (or similar things using different URLs, e.g. chrome:// or
absolute file:// URLs) seems to have no effect whatsoever within my
application. In fact, it doesn't even try to access the ellipsis.xml file at
all, according to strace.
Obviously XUL is able to do what I want, so I'm assuming I'm doing something
wrong, or am simply missing out on some detail I have to take care of first in
order to get the desired results.
What I'm looking for is a way to pull the regular text-overflow: ellipsis;
track within a XUL application or, alternatively, a way to get the same result
without the aforementioned technique.
For some (maybe security) reason you need to use a chrome:// url in your CSS file. I tested it with conkeror 0.9.2 and xulrunner 1.9.1.
-moz-binding: url("chrome://conkeror/content/ellipsis.xml#ellipsis");
Where your ellipsis.xml is in /conkeror/install/path/modules/ (on debian /usr/share/conkeror/modules). You can check the chrome.manifest file to find the right location for your XML file, probably the style folder.
You said it´s not having ANY effect?
With
display:block; text-overflow:clip; overflow:hidden; white-space:nowrap;
it should at least cut off the text without the "...".
Is the reference to your xml file correct and your css and xml files are at the same path?
Also, try using this code:
<?xml version="1.0"?>
<bindings
xmlns="http://www.mozilla.org/xbl"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
>
<binding id="none">
<content><children/></content>
</binding>
<binding id="ellipsis">
<content>
<xul:label crop="end"><children/></xul:label>
</content>
<implementation>
<field name="label"> document.getAnonymousNodes( this )[ 0 ] </field>
<field name="style"> this.label.style </field>
<property name="display">
<getter>
this.style.display
</getter>
<setter>
if( this.style.display != val ) this.style.display= val
</setter>
</property>
<property name="value">
<getter>
this.label.value
</getter>
<setter>
if( this.label.value != val ) this.label.value= val
</setter>
</property>
<method name="update">
<body>
var strings= this.textContent.split( /\s+/g )
if( !strings[ 0 ] ) strings.shift()
if( !strings[ strings.length - 1 ] ) strings.pop()
this.value= strings.join( ' ' )
this.display= strings.length ? '' : 'none'
</body>
</method>
<constructor> this.update() </constructor>
</implementation>
<handlers>
<handler event="DOMSubtreeModified"> this.update() </handler>
</handlers>
</binding>
</bindings>
Related
Is it possible to change default color of the TimePickerAndroid component ?
You would have to change it from the styles.xml file of android. Here's what you do:
1) Open up styles.xml: "android/app/src/main/res/values/styles.xml"
2) you'll need to add a few lines:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:timePickerDialogTheme">#style/Dialog.Theme</item>
</style>
<style name="Dialog.Theme" parent="Theme.AppCompat.Light.Dialog">
<item name="colorAccent">#FF0000</item>
<item name="android:textColorPrimary">#0000FF</item>
</style>
In styles.xml you should already have:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
If you do just add the remaining lines. If not go ahead and add them.
4) Lastly, just recompile the app. "react-native run-android". You should see the color change right away.
Using React-native, unfortunately no.
However, by changing some java files in RN and using this solution from SO you might be able to do it.
If you succeed doing this, I suggest you create a Pull Request on RN's repository as it might be very useful for other users.
You could also develop it as a module and open source via NPM.
I am trying to pre-populate some a few different objects in a User Story in my TFS2012 work items list. The HTMLFieldControl is can be found in the Work Item Types section and I can see that it's created here:
<Tab Label="Details">
<Control FieldName="System.Description" Type="HtmlFieldControl" Dock="Fill" />
</Tab>
I've been looking on Google but I just can't seem to find anything around adding text into this field so that it is always available, perhaps I'm just doing something wrong.
Would doing something similar to this give me the results I require? I can't really just try it and potentially break the system (which is unfortunate) so I need some guidance so that I could quickly fix any formatting / spelling without having to roll back any changes.
<Tab Label="Details">
<Control FieldName="System.Description" Type="HtmlFieldControl" Dock="Fill" >
<FIELD name="Description" refname="System.Description" type="Text" Content="Hello there"/>
</Control>
</Tab>
Obviously the above is purely made up (from the FIELD section) but I included here just along the lines of what I was thinking and hopefully to show what I'm trying to do.
You were looking in the wrong place; those are the definitions for the form (aka, how the Work Item is displayed graphically). You need to scroll up to the top, under FIELDS, and find this:
<FIELD name="Description" refname="System.Description" type="HTML" />
...then change it to this:
<FIELD name="Description" refname="System.Description" type="HTML">
<DEFAULT from="value" value="Hello there" />
</FIELD>
I took a look at flex metadata and it seems to be quiet straight forward. Though I have a problem, I don't get autocompletion for the metadata.
I'll tell you what I did, maybe you find an error. I want to create my own Style metadata tag named e.g. MyStyle. I want to create my own because it's easier for me to determine at runtime if the metadata was added by me or by the flex framework (therefore I will not use the predefined Style metadata tag).
To add metadata is pretty simple, I just wrote this code to get it work:
<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
width="1024" height="768">
<fx:Metadata>
[MyStyle(required="true")]
</fx:Metadata>
</s:Group>
On my WindowedApplication component I added an added to stage listener to the stage. So all elements that are added to the application will fire that Event.ADDED when they are added to the stage. In that eventHandler I scan added elements for my metadata tag.
protected function addedToStageListener(event:Event):void
{
var classInfo:XML = describeType(event.target);
for each (var x:XML in classInfo..metadata)
{
if (x.#name == "MyStyle")
trace(x);
}
}
I also added a flex-config.xml file (in the toplevel of my src folder) to add the compiler options, so that I can read my custom metadata tag on runtime. The file looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<flex-config>
<compiler>
<keep-as3-metadata>
<name>MyStyle</name>
</keep-as3-metadata>
</compiler>
</flex-config>
When I run this, I get the result I expect
<metadata name="MyStyle">
<arg key="required" value="true"/>
</metadata>
So this works. My next step was to add autocompletion when adding the metadata tag to the code. To do this you should create a metadata.xml which specifies the metadata tags right?
So I did this and I ended up with this simple metadata.xml
<?xml version="1.0" encoding="UTF-8"?>
<annotations version="2.1.1">
<metadata name="MyStyle" description="Adds style.">
<context name="class" />
<attribute name="required" type="Boolean" required="true" />
</metadata>
</annotations>
To add the metadata.xml correctly to the project I followed that tutorial by Adobe, but it doesn't work. I don't get autocompletion. Do you have any suggestions?
Update: I use Flash Builder 4.6 Professional and I created a Flex Library Project.
I have browsed through many articles, but none of them mention how I can go about redesigning the toplinks at the top of any Magento store.
Does anyone know how I can modify the default links which are found in the top right of my Magento store and assign an icon to each link and also spread the links across the full width of the top area.
It may include something like the below (example only).
Any suggestions would be much appreciated.
My website is: www.efficienttrade.co.nz if that helps.
Thanks,
Jason
Find the top.links in layout xml files and add a class. Then, you can customize this class via css.
For instance,
<!-- this piece of code available in rss.xml, look at the class define -->
<reference name="footer_links">
<action method="addLink" translate="label title" module="rss" ifconfig="rss/config/active"><label>RSS</label><url>rss</url><title>RSS</title><prepare>true</prepare><urlParams/><position/><li/><a>class="link-rss"</a></action>
</reference>
Same as Ogüz answer + more information:
You have to be a little bit like Sherlock Holmes.
The top links are generated thanks to a block that you can find in the layout file page.xml of your theme. Then search the block name "topLinks" in the header block (in the default theme, it's the name) and you will find <block type="page/template_links" name="top.links" as="topLinks"/>. This block topLinks is generated thanks to the block class Mage_Page_Block_Template_Links. The important method in this block is public function addLink(...), it means that you will have to search into the xml layout the following element/tag <action method='addLink'>...</action>.
An example for the customer module, in the file customer.xml of the layout folder:
<reference name="top.links">
<action method="addLink" translate="label title" module="customer"><label>My Account</label><url helper="customer/getAccountUrl"/><title>My Account</title><prepare/><urlParams/><position>10</position></action>
</reference>
You should find more than one xml element which uses this kind of method.
Pay attention, the addLink method can also be called programmatically (into PHP code), not only in layout file.
Hope it helps
I am looking to get as close as I can to parsing out an AS3 file into objects or XML. For instance, imagine the following class:
package {
class SomeClass extends AnotherClass {
private var someVariable:Number
public function someMethod(someParameter:Number = 4):void {
var someLocalVariable:Number = someParameter * (2 + someVariable);
}
}
}
When parsed, it might be something like:
<package name="">
<class id="783" name="SomeClass" extendsId="782">
<variable id="784" visibility="private" type="Number"/>
<function id="785" name="someMethod" returnType="void">
<parameter id="786" name="someParameter" type="Number">
<expression>
<number value="4"/>
</expression>
</parameter>
<variable id="787" name="someLocalVariable" type="Number"/>
<code>
<assign toId="787">
<expression>
<variable id="786"/>
<operator type="*"/>
<expression>
<number value="2"/>
<operator type="+"/>
<variable id="786"/>
</expression>
</expression>
</assign>
</code>
</function>
</class>
</package>
.. even if I don't get a nice, neat xml structure like this, even if it could just parse AS3 to some kind of capacity, it would be way beyond where I am now.
Any thoughts?
Thanks,
Eric
I have actually ported the PMD parser to AS3.
You can check out http://github.com/teotigraphix/as3parser-framework
Mike
FlexPMD has an as3 parser. (FlexPMD is a Java project by Adobe that does reporting of best practices violations in as3 source code.)
FlexPMD is hosted at http://opensource.adobe.com/wiki/display/flexpmd/FlexPMD
The code is on a subversion repo at http://opensource.adobe.com/svn/opensource/flexpmd/trunk
The down side is you would need to use Maven to build FlexPMD (me, I never managed to get it to work), but since you need just one or three projects, it might be possible to extract those by hand without too much cursing and shouting.
You may also want to wander further into the Flex SDK source code (also on opensource.adobe.com) to see if Adobe provides any other software for parsing as3,but I have not looked there.
There's a lexer, parser, and tokenizer in the AS3eval project:
AS3eval
Take a look at the flash.utils.describeType() documentation.
http://livedocs.adobe.com/flex/gumbo/langref/flash/utils/package.html#describeType()
It's for describe actionscript items at runtime, but should have some use in this case.