CQ5 using fileuploaddialogbuton xtype - adobe

Can anyone post an example of how to setup fileuploaddialogbutton widget in a dialog?
I'm assuming this can be done - From the docs:
"The FileUploadDialogButton creates a button that opens a new dialog for uploading a file via the FileUploadField. Can be used inside edit dialogs where the upload must happen in a separate form in the new dialog."
The only results my searches seem to return is the Widget API documentation which offer no examples.
I've tried various random configurations in my dialog but get the JS error:
TypeError: c.setSize is not a function
c.setSize(cw || undefined, ch || undefined);
Note I'm not specifying any height or width in the config (documentation doesn't list them as options). Can anyone offer an example of how to configure this correctly (dialog.xml snippet would be great)?
Thanks in advance
EDIT:
Here is my dialog XML as it stands. It gives the error, but it's not the only version that causes this js error in the console, nor do I make any claims that this should work hence (due to the lack of documentation) me asking for an example.
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="cq:Dialog"
height="{Long}700"
xtype="dialog">
<items
jcr:primaryType="cq:Widget"
xtype="tabpanel">
<items jcr:primaryType="cq:WidgetCollection">
<tab1
jcr:primaryType="cq:Panel"
title="Tab 1">
<items jcr:primaryType="cq:WidgetCollection">
<name
jcr:primaryType="cq:Widget"
fieldLabel="Enter name"
name="./theName"
xtype="textfield"/>
<description
jcr:primaryType="cq:Widget"
fieldLabel="Change description"
name="./changeDescription"
xtype="richtext"/>
<files
jcr:primaryType="cq:Widget"
collapsed="{Boolean}false"
collapsible="{Boolean}false"
title="Files"
xtype="dialogfieldset">
<items jcr:primaryType="cq:WidgetCollection">
<test
jcr:primaryType="cq:Widget"
fieldLabel="Test"
xtype="textfield"/>
<file-upload
jcr:primaryType="cq:Widget"
dialogTitle="the dialog title"
fieldLabel="the field label"
text="the text"
xtype="fileuploaddialogbutton"/>
</items>
</files>
</items>
</tab1>
</items>
</items>

Related

TreeView in FXML

How can I create a TreeView in FXML including all the branches and components in it? I can't find documentation about it. There is just code about how to populate it but I want to do it in FXML so y can have the design apart of the logic.
There's no specific documentation for FXML (beyond the Introduction to FXML document): but there is no need for any. An element beginning with an uppercase character is an instruction to instantiate the class of that name, so
<TreeView></TreeView>
will instantiate a TreeView. Attributes correspond to properties, so if you needed you could do
<TreeView editable="true"></TreeView>
Nested elements beginning with lower case also correspond to properties, and will be set to the enclosed FXML structure. So you can create a tree view with code like
<TreeView fx:id = "treeView">
<root>
<TreeItem fx:id="rootItem" value="Root" expanded="true">
<children>
<TreeItem fx:id="child1" value="Child 1" expanded="true">
<children>
<TreeItem fx:id="child11" value="Child 1.1"></TreeItem>
<TreeItem fx:id="child12" value="Child 1.2"></TreeItem>
</children>
</TreeItem>
<TreeItem fx:id="child2" value="Child 2">
<children>
<TreeItem fx:id="child21" value="Child 2.1"></TreeItem>
<TreeItem fx:id="child22" value="Child 2.2"></TreeItem>
</children>
</TreeItem>
</children>
</TreeItem>
</root>
</TreeView>
You can, of course, see all the properties in the API documentation.

How to use the same component in more than one place in JavaFX?

I want to use the same MenuItem in a MenuBar and in a ContextMenu (both have the same text, will be enabled/diSabled under the same conditions, and will perform the same task). How can I achieve this in FXML in the same file?
I tried using <fx:reference> but it only shows up in the first place I deference it.
<MenuBar>
<menus>
<MenuItem fx:id="menuToDuplicate" />
</menus>
</MenuBar>
.
.
.
<ContextMenu>
<items>
<!--Same MenuItem as above -->
</items>
</ContextMenu>

Add an 'X' to clear TextInput when User has entered Text

I have a UX class called InputWithLabel that includes both a label and a TextInput.
I am trying to add an 'X' to it that can be used to clear the input text. My plan is to later add the functionality to only display this 'X' when there is actual text in the input field.
For now though, I can't figure out how to do this while not allowing the input to go over top of the 'X'. If you think it's a bug, I'll clean it up and report it as such but I suspect it's just something simple I don't understand so I thought I'd just ask you about it... I tried a number of ideas but none of them seemed to work for me...
<StackPanel ux:Class="InputWithLabel" Width="50%">
<string ux:Property="Label" />
<string ux:Property="Value"/>
<string ux:Property="IsPassword"/>
<Text Color="#28549b" FontSize="12" Margin="0,12,0,0" Value="{ReadProperty Label}"/>
<Rectangle CornerRadius="2" StrokeWidth="1" StrokeColor="#bdbebf">
<TextInput FontSize="16" Value="{Property Value}" IsPassword="{ReadProperty IsPassword}"/>
<Panel ux:Name="ClearButton" Alignment="Right">
<Rectangle SnapToPixels="True" Height="1px" Width="10px" Color="#bdbebf">
<Rotation Degrees="45"/>
</Rectangle>
<Rectangle SnapToPixels="True" Height="1px" Width="10px" Color="#bdbebf">
<Rotation Degrees="-45"/>
</Rectangle>
</Panel>
</Rectangle>
</StackPanel>
There is no bug, it's all about understanding how layout works in Fuse. When you put a TextInput along with a Panel in a Rectangle, they both occupy the same space. There is no implicit space consumption happening (by design). The result of that is, as you can see, that things go over one another.
To achieve what you need, it would be a far better strategy to go with a DockPanel, because inside of a DockPanel you can explicitly consume space by docking its children to its sides. Here's an example, based on the code you initially posted:
<StackPanel ux:Class="InputWithLabel" Width="50%" IsPassword="false">
<string ux:Property="Label" />
<string ux:Property="Value"/>
<string ux:Property="IsPassword"/>
<Text Color="#28549b" FontSize="12" Margin="0,12,0,0" Value="{ReadProperty Label}"/>
<DockPanel>
<Rectangle CornerRadius="2" StrokeWidth="1" StrokeColor="#bdbebf" Layer="Background" />
<TextInput FontSize="16" Value="{Property Value}" IsPassword="{ReadProperty IsPassword}" Margin="4">
<WhileContainsText Invert="true">
<Change clearButton.Visibility="Collapsed" />
</WhileContainsText>
</TextInput>
<Panel ux:Name="clearButton" Dock="Right">
<Rectangle SnapToPixels="True" Height="1px" Width="10pt" Color="#bdbebf">
<Rotation Degrees="45"/>
</Rectangle>
<Rectangle SnapToPixels="True" Height="1px" Width="10pt" Color="#bdbebf">
<Rotation Degrees="-45"/>
</Rectangle>
</Panel>
</DockPanel>
</StackPanel>
You'll notice I also included UX code for only showing the close button when there's some text in the input. Cheers!
You're welcome to visit Fuse docs to read more about Layout in general and Responsive layout in particular for useful details on the topic.

Disable Save and SaveAs buttons when opening Word using Asp.net

In the office project added below code in ribbon xml
<?xml version="1.0" encoding="UTF-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2010/07/customui" onLoad="Ribbon_Load">
<commands>
<command idMso="FileSaveAs" enabled="false" />
<command idMso="FileSave" enabled="false" />
</commands>
</customUI>
and also added below line of code in ThisAddIn.cs
protected override Microsoft.Office.Core.IRibbonExtensibility CreateRibbonExtensibilityObject()
{
return new Ribbon1();
}
Could you please tell me how it is getting called when I open Word document using asp.net. Currently disabling of requested buttons not working.

Flex error: could not resolve to a component implementation

I am trying to create a menu bar with the following items: File, Database, Navigate, Window. However, I am getting an error which I do not understand: Could not resolve <mx:XMLList> to a component implementation. Can anyone explain the error to me? My code is as follows:
`
<mx:XMLList id="topLevelMenu">
<menuitem label="File" />
<menuitem label="Database"/>
<menuitem label="Navigate"/>
<menuitem label="Window" />
</mx:XMLList>
<mx:MenuBar width="100%" height="20" labelField="#label" id="mainMenuBar" dataProvider="{topLevelMenu}" />`
I googled for it and found a lot problems which generate this error message. None of them seemed to fit my case. When is this error generated?
The error means, basically, that the compiler can't find a component.
In this case, XMLList is not in the mx namespace. You didn't show the code where you import namespaces, but I assume you're using the default.
I suggest creating your XMLList in ActionScript, not MXML. I believe something like this should work:
public var topLevelMenu : XML = <menuItems>
<menuitem label="File" />
<menuitem label="Database"/>
<menuitem label="Navigate"/>
<menuitem label="Window" />
</menuItems>;
Then somewhere, perhaps in a creationComplete Handler you can change this into an XMLList
var myList : XMLList = topLevelMenu.menuitem
This code is written in the browser and untested.

Resources