Hide a binded TreeViewItem in a TreeView
Hello,
In my application, i have binded a ObservableCollection to a TreeView using an HierarchicalDataTemplate. On some condition i am firing an command and i have to hide few of the treeviewitems from the treeview.
In this command, few conditions i am checking in the back end code and setting a property 'IsRequiredInView' to true. Now when this property is true, i have to make the treeviewitem visible in the view. I tried using the Visibility property but it will show
the empty space in the view where TreeViewItem was present.
How i can hide the entire treeViewItem from the TreeView?
Thanks in advance,
IamHuM
>>How i can hide the entire treeViewItem from the TreeView?
By setting its Visibility property to Collapsed. You could do this by defining an ItemContainerStyle:
<TreeView>
<TreeView.ItemContainerStyle>
<Style TargetType="TreeViewItem">
<Style.Triggers>
<!-- hide the item with Header = "1" -->
<Trigger Property="Header" Value="1">
<Setter Property="Visibility" Value="Collapsed"/>
</Trigger>
</Style.Triggers>
</Style>
</TreeView.ItemContainerStyle>
<TreeViewItem Header="1"/>
<TreeViewItem Header="2"/>
<TreeViewItem Header="3"/>
</TreeView>
If you have a boolean property called IsRequiredInView in the data context class of the TreeView you could use a DataTrigger that sets the Visibility property of the TreeViewItem conditionally when this property returns true or false:
<TreeView.ItemContainerStyle>
<Style TargetType="TreeViewItem">
<Style.Triggers>
<DataTrigger Binding="{Binding IsRequiredInView}" Value="False">
<Setter Property="Visibility" Value="Collapsed"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TreeView.ItemContainerStyle>
Hope that helps.
Please provide a reproducable sample of your issue if you want any further help. Bet setting the Visibility property in an ItemContainerStyle is the key to be able to hide a TreeViewItem.
Please also remember close your threads by marking helpful posts as answer and then start a new thread if you have a new question. Please don't ask several questions in the same thread.
Similar Messages
-
How to hide/unhide the all Treenodes on Treeview based on Checkbox changed event?
Checkbox(Control)
1.Checkbox Checked:(Action below like)
if user click on Checkbox, all the treenodes on treeview is hide.
2.Checkbox Unchecked(Action below like)
If user uncheck the Checkbox all the treenodes on treeview is unhode.
Could you please help me how to do above one.
BadriHi,
According to your post, my understanding is that you want to hide/show the TreeView when the Checkbox checked/unchecked.
We can use jQuery to achieve it, the following script for your reference:
<script src="http://code.jquery.com/jquery-1.10.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$("input[type=checkbox]").click(function () {
if (this.checked) {
$("#TreeViewID").hide();
} else {
$("#TreeViewID").show();
</script>
More information:
http://dineshsharepoint.blogspot.com/
Best Regards
Dennis Guo
TechNet Community Support -
[SOLVED] Hide drives & bind folder from nautilus
I have trying to hide some of my drives from nautilus side-bar for long time after i moved to arch.
i had been following the post 124445 but /etc/udev/rules.d is not working for me!
I'm using
# Window Manager: Compiz
# Desktop Environment: Xfce
# File Browser: Nautilus
EDITED:
Binded Folder problem detail in post #9
Last edited by rhoit (2013-02-04 19:42:41)'/etc/udev/rules.d/10-hide-drives.rules' solved my problem! BUT still few more
# Problem 1
Some weird problem Occured NOW Music drive still seems to be shown when i open file browser ( nautilus ) and it remains there.
but if i open
$ nautilus /
before opening my home folder then its not shown!
# Problem 2
It seems that the binded folder seems to have the problem! and it add the device icons!
i have used fstab to mount it with option auto,x-systemd.automount
Weird Problem /dev/sda8 ==> /home/rho/Music
Binded folder /media/Dump/downloads ==> /home/rho/Downloads
here is my fstab
# /etc/fstab: static file system information
# <file system> <dir> <type> <options> <dump> <pass>
# System
UUID="f12d8af7-5482-4a05-b40f-816d3f574236" / ext4 rw,relatime,data=ordered 0 1
UUID="8119c92f-2fc5-4016-8925-bb5bed013be6" /boot ext4 rw,relatime,data=ordered 0 2
UUID="bbb2e2a0-63b8-4896-b7f4-f77884e791c0" /var ext4 rw,relatime,data=ordered 0 2
UUID="c08ea485-32b2-4e14-a589-c335592c7a9b" /home ext4 rw,relatime,data=ordered 0 3
UUID="125620a5-a6c4-41cb-9bb5-1fe28c0f84ab" none swap defaults 0 0
# Custom
UUID="e96e950a-b733-495e-9d22-32843e6dea22" /mnt/Core ext4 noauto,x-systemd.automount 0 3
UUID="bccecaef-d098-4b67-9cd3-fce05ed3d363" /mnt/elib ext4 noauto,x-systemd.automount 0 3
UUID="e1b574dc-062e-4be6-ba12-9aae8ef6c9c2" /home/rho/Music ext4 noauto,x-systemd.automount 0 3
UUID="9f204245-5c6a-45cb-8138-5025218ad3c8" /media/Dump ext4 x-systemd.automount 0 3
### Bindings
/media/Dump/downloads /home/rho/Downloads none bind 0 0
none /sys/kernel/debug debugfs defaults 0 0
Last edited by rhoit (2013-01-18 09:59:24) -
Hide Bind Variable in the Customization form of a Report
I have a report where I set the bind variable default using a API call. I do not want the user to change the value. How do I keep the text box for the bind variable value from showing????
Thanks,
LindaHi,
It is not possible to hide a bind variable from appearing in the customization form. You can run the report directly with the
parameters and not take the user to the customization screen.
Say you have a bind variable dept in a report new_report then the url the user should use will be like this
http://mydomain/pls/portal30/portal30.new_report.show?p_arg_names=dept&p_arg_values=10
Thanks,
Sharmila -
Need help in Bind variable in AF Query LOV
Hi,
i have one problem with bind variable, if i use bind variable in the LOV VO Query then my result is not coming, if there is not bind variable it's working fine and if i use the bind variable in the LOV search option then it's working fine but if i hide the bind variable and set the value in AM prepareSesstion method the LOV is not returning any value. I try to return the values also all values are also coming but those values are not setting to AF Query Attribute.
Query is:
select substr(d.description,0,40) description
from cm_system_users a,
cm_user_responsibilities b,
cm_responsibility_processes c,
cm_processes d
where a.nt_login =:B_NT_LOGIN
and a.user_id = b.user_id
and trunc(sysdate) between b.eff_date and nvl(b.exp_date,sysdate + 1)
and b.RESPONSIBILITY_ID = c.RESPONSIBILITY_ID
and c.process_type = d.process_type
and d.enabled_flag = 'Y' order by d.arguments_flag
AM Method:
CmProcessViewImpl vo = getCmProcessView();
String nt_login = getUserPrincipalName();
vo.setNamedWhereClauseParam("B_NT_LOGIN", nt_login.toUpperCase());
vo.executeQuery();
Can any one help me in this. it's urgent for me.This is a little underdescribed. IIUC, the view object in question is being used as a target for a view accessor, correct? (Otherwise you'll have to be more explicit about what you mean by "Query LOV".
If I'm right, there are two possibilities:
1) You are using a VO instance in a shared application module instance. If so, make sure your code is in the prepareSession() for that application module class if it's session dependent (as it seems to be below), you need to make sure the application module instance is shared at session scope.
2) You've based the view accessor directly on the VO definition. This basically creates an anonymous VO instance; I don't think there's any way to use prepareSession() to set a bind variable on such an instance (which won't be created until the accessor is first used). You might be able to get by with putting similar code into the view object class' create() method, but I haven't tested this.
If your code is in your primary application module class (as opposed to the class for a shared AM instance), the problem here is that getCmProcessView() returns the VO instance from that application module instance's design-time data model, which is never used by view accessors.
By the way, why do you need to do this in prepareSession() instead of at the view accessor level? I believe you can get the logged in user name (for the view accessor) in with the groovy expression
viewObject.DBTransaction.session.userPrincipalName
or possibly just
DBTransaction.session.userPrincipalName
(despite this involving DBTransaction, it returns the web app user name, not the DB username).
That's a 100% declarative solution, if you don't count the Groovy expression as non-declarative.
If you're afraid of a user executing the LOV (somehow) before the bind variable value gets set, just ensure that the bind variable is marked "required". -
Trouble binding updated properties to view
Hi Guys,
I have the following code which i want to to populate a combobox based upon the selected item of a treeview.
as depending on what node is chosen will populate the combobox with a different list of report levels.
the combobox is within a user control and i am trying to bind to a dependency property ReportLevel i have in my MainViewModel. if i set the value of the combobox its fine but i want to be able to update it whenever a user choses a different node on the tree.
this is my xaml
<UserControl x:Class="RTHM.ComboboxControl1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup- compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
xmlns:local ="clr-namespace:RTHM.ViewModels"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
ItemsSource="{Binding Path=Levels}"
IsSynchronizedWithCurrentItem="True"
DisplayMemberPath="Name"
SelectedItem="{Binding Path=SelectedLevel, Mode=TwoWay}"
IsEnabled="{Binding IsEnabled}"/>
my code behind:
public partial class ComboboxControl1 : UserControl
public ComboboxControl1()
InitializeComponent();
DataContext = new MainViewModel();and in my viewmodelprivate ObservableCollection<ReportLevel> _levels;
public ObservableCollection<ReportLevel> Levels
get
return _levels;
set
_levels = value;
NotifyPropertyChanged("Levels");
}my MainViewModel inherits from a base class which has INotifyProperty changed and an implementationpublic class ViewModelBase : INotifyPropertyChanged
public event PropertyChangedEventHandler PropertyChanged;
protected void NotifyPropertyChanged(string propertyName)
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}any Ideas on how to update the Comboboxs ItemSource dynamically?Thanks in advanceThey are presumably in the same datacontext?
Hmmmm
I wonder if you should really have that combo in a separate usercontrol.
Anyhow.
You've Bound the treeview to a collection of whatever that is bound to.
( You haven't explained a bunch of relevant stuff here mate )
Call that a collection of trees.
A tree presumably has a collection of reportlevels in it.
Vaguely like
public class tree()
public observablecollection<reportlevel> reportlevels [get;set;}
But maybe with some propertychange stuff.
Bind selecteditem of the treeview to selectedtree in your viewmodel.
Bind itemssource of the combo to selectedtree.reportlevels.
Hope that helps.
Recent Technet articles: Property List Editing;
Dynamic XAML -
Need help on ADF Trinidad Table
Hi,
I got one strange problem, i have one AF Query and result table, in my af query 2 fields are LOV's have created LOV followed by the below link
http://andrejusb.blogspot.com/2008/11/adf-query-component-and-view-criteria.html LoV is coming fine but on the result table values are coming as a numbers.
For example in my LOV i have 3 values 1. Apple, 2. Orange 3. Grapes.
Now in the table fruits coloum i am getting 1 instead of Applet. and another row 3 instead of grapes.
Can any one help how can i get the values in the table instead of numbers.
It's urgent for me.
Regards,Hi,
My problem was resolved, if i use Combo box with list of values is's working fine.
But here i have one more problem like if i use bind variable in the LOV VO Query then my result is not coming, if there is not bind variable it's working fine and if i use the bind variable in the LOV search option then it's working fine but if i hide the bind variable and set the value in AM prepareSesstion method the LOV is not returning any value.
Query is:
select substr(d.description,0,40) description
from cm_system_users a,
cm_user_responsibilities b,
cm_responsibility_processes c,
cm_processes d
where a.nt_login =:B_NT_LOGIN
and a.user_id = b.user_id
and trunc(sysdate) between b.eff_date and nvl(b.exp_date,sysdate + 1)
and b.RESPONSIBILITY_ID = c.RESPONSIBILITY_ID
and c.process_type = d.process_type
and d.enabled_flag = 'Y' order by d.arguments_flag
AM Method:
CmProcessViewImpl vo = getCmProcessView();
String nt_login = getUserPrincipalName();
vo.setNamedWhereClauseParam("B_NT_LOGIN", nt_login.toUpperCase());
vo.executeQuery();
Can any one help me in this. -
Javascript Autocomplete by Tom Petrus and VC
Hi
I am using the following on my interactive report to provide a google search like autocomplete as the user enters a name, surname, date etc
This works find apart from when searching for a surname such as 'Rees' it does not bring this back but will bring back suggestions like 'Crees'. 'Freestone' etc
Same for forename when searching for 'Ian' it does not bring this back 'Ian' but brings back 'Adrian', 'Brian' etc
This only happens on certain names however searching for 'Paul', 'Steven' 'Brian' works fine
If anyone could shed any light into what's causing this it would be most helpful
function srch2(pItem, pColumn) {
$.post('wwv_flow.show',
{"p_request" : 'APXWGT',
"p_widget_action" : 'FILTER',
"p_widget_action_mod" : 'ADD',
"p_widget_mod" : 'ACTION',
"p_widget_name" : 'worksheet',
"p_flow_id" : $v('pFlowId'),
"p_flow_step_id" : $v('pFlowStepId'),
"p_instance" : $v('pInstance'),
"x01" : $v('apexir_WORKSHEET_ID'),
"x02" : $v('apexir_REPORT_ID'),
"x03" : pColumn,
"f01" : ['COLUMN', pColumn, '=', $v(pItem), null, 'minutes']
function(data){
//when the filter has been successfully applied the report has to be refreshed
if(data=="true"){
gReport.pull();
//clear the item
$s(pItem,'');
$(document).ready(function(){
//hide IR toolbar
$('#apexir_TOOLBAR').hide();
$('#P4_AC').bind("result", function(){
//on selecting a value then fire the search function
srch2(this, 'INDSNAME');
// ac item P4_AC2
$('#P4_AC2').bind("result", function(){
srch2(this, 'INDFNAME');
// ac item YEARD
$('#YEARD').bind("result", function(){
srch2(this, 'NEWYEAR');
// ac item REG
$('#REG').bind("result", function(){
srch2(this, 'INDREG');
// ac item ENTNO
$('#ENTNO').bind("result", function(){
srch2(this, 'INDENT');Hi Tom
Could it be that on the interactive report it mentions "This query returns more than 100,000 rows, please filter your data to ensure complete results."
There is no plugin its just using the two pieces of code I mentioned in the threads above
This is the original thread
https://forums.oracle.com/thread/2412281 -
SharePoint Custom Tree view with CheckBoxes
How to Unhide and Hide Treenodes in treeview based on Checkbox checked changed event in Asp.net
BadriHow to
hide/unhide the all Treenodes on Treeview based on Checkbox changed event?
Checkbox(Control)
1.Checkbox Checked:(Action below like)
if user click on Checkbox, all the treenodes on treeview is hide.
2.Checkbox Unchecked(Action below like)
If user uncheck the Checkbox all the treenodes on treeview is unhode.
Thank you for your understanding, Iam not good at english.
Could you please help me how to do above one.
Badri -
Searching 2 years either side of a date field?
Hi
In my query I would like the search to be able to search 2 years either side of a specified search date in my interactive report
select
ROWID,
ID,
COLUMN1,
COLUMN2,
TO_CHAR(INDDOB, 'YYYY') AS NEWYEAR
from TABLENAME
ORDER BY INDDOB asc
The interactive report is also using custom Javascript to offer an autocomplete search as per this thread For VC - Using multiple Autocomplete on a page?
So I am unsure how this would work by allowing the date results to include 2 years either side of the chosen date?Mike many thanks for this
INDDOB is a date field in the DB and the item name is :YEARD
Using the following WHERE clause and a default vale of 1930 in the :YEARD item name is returning the correct result i.e. 1930 plus records from 1928,1929,1931 and 1932
select
ROWID,
ID,
INDSUB,
INDDOD,
INDREG,
INDENT,
INDDOD,
INITCAP(INDSNAME) indsname,
INITCAP(INDFNAME) INDFNAME,
TO_CHAR(INDDOD, 'YYYY') AS NEWYEAR,
DELDOC from RAMBO.TABLENAME
WHERE to_char(INDDOD,'YYYY') between :YEARD -2 and :YEARD +2
ORDER BY INDDOD asc
The problem is however when I try and change the search value in :YEARD from the default 1930 to for example 1950 (which is also in the db)
When doing this it brings back no results? Could it be something to do with the associated code below which provides an autocomplete feature and search of the IA report as you type in the field name.
In the :YEARD item under label and HTML table Cell attributes has the following
onkeydown="if($f_Enter(event)){srch3($v('YEARD')); return false;}"
and under the list of values in the definition for :YEARD is
select distinct TO_CHAR(INDDOD, 'YYYY') from RAMBO.TABLENAME order by 1
Also under page and Javascript is the following
function srch2(pItem, pColumn) {
$.post('wwv_flow.show',
{"p_request" : 'APXWGT',
"p_widget_action" : 'FILTER',
"p_widget_action_mod" : 'ADD',
"p_widget_mod" : 'ACTION',
"p_widget_name" : 'worksheet',
"p_flow_id" : $v('pFlowId'),
"p_flow_step_id" : $v('pFlowStepId'),
"p_instance" : $v('pInstance'),
"x01" : $v('apexir_WORKSHEET_ID'),
"x02" : $v('apexir_REPORT_ID'),
"x03" : pColumn,
"f01" : ['COLUMN', pColumn, '=', $v(pItem), null, 'minutes']
function(data){
//when the filter has been successfully applied the report has to be refreshed
if(data=="true"){
gReport.pull();
//clear the item
$s(pItem,'');
$(document).ready(function(){
//hide IR toolbar
$('#apexir_TOOLBAR').hide();
$('#P4_AC').bind("result", function(){
//on selecting a value then fire the search function
srch2(this, 'INDSNAME');
// ac item P4_AC2
$('#P4_AC2').bind("result", function(){
srch2(this, 'INDFNAME');
// ac item YEARD
$('#YEARD').bind("result", function(){
srch2(this, 'NEWYEAR');
// ac item REG
$('#REG').bind("result", function(){
srch2(this, 'INDREG');
// ac item ENTNO
$('#ENTNO').bind("result", function(){
srch2(this, 'INDENT'); -
How to get Select menu to determine next set of (hidden) inputs?
Operating System: Mac OSX 10.6
Software: Dreamweaver CS4, with local testing environment.
The website i am currently creating uses form based quotes, (for a printing business).
See here, http://www.barringtonprint.com/perfect/quote-continuous.html for the current webpage i am working on.
I want to use a select menu to determine how many 'parts' the user requires, and for it to then display the necessary text fields for them to fill in.
At the monent the form just has the maximun amount (7) already on the form, and just requires the user to leave the non-required fields empty.
However i would like the form to just have inputs for the first 'part' (Part 1), with a select menu that gives the user the option to select more than 1 'part' and then display how many more rows of text fields are needed depending on the outcome of the select menu.
I presume i will need to use javascript to do this but i am unsure on how to proceed.
NOTE: these are old forms that i have inherited and do use tables, im aware this is not the best way to proceed, however im sticking with them for now.
Any help will be much appreciated, as this is driving me nuts.
Andrew BarringtonI'm sure there are cleaner ways of doing this, but I already had this put together from another project. Hopefully it will get you started.
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>HTML5 Form with jQuery Validation</title>
<!--[if lt IE 9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
<!--JQUERY LATEST-->
<script src="http://code.jquery.com/jquery-latest.min.js">
</script>
<!--JQUERY VALIDATE-->
<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js">
</script>
<style>
/**BEGIN FORM STYLES**/
#contact {
font-size: 14px;
width:800px; /**adjust width in % or px as needed*/
margin: 0 auto; /**adjust margins as needed*/
background: #FFF;
border: 2px groove #999;
padding: 2%;
#contact fieldset {
margin-bottom:5px;
background:#CCC;
#contact legend {
padding: 8px;
background: #000;
font-weight: bold;
color: #FFF;
line-height: 1.5;
/**wrap form lables and fields inside ordered lists for better web accessibility**/
#contact ol {
list-style:none;
margin:0;
padding:0}
#contact li {
padding:5px;
margin: 0;
clear: left;
#contact label{
display:inline-block;
float:left;
line-height: 23px; /**lines up labels with fields**/
width:15%;
font-size: 12px;
text-align:right;
margin-right: 10px; /*space between labels, fields*/
#contact textarea,
#contact input[type=text],
#contact input[type=email],
#contact input[type=number] {
width: 45%; /**same width on fields**/
padding: 5px;
color:#333;
font-family:Arial, Helvetica, sans-serif;
font-size: 12px;
#contact select {width:46.5%}
/**field background on focus**/
#contact input:focus,
#contact input:active,
#contact textarea:focus,
#contact textarea:active,
#contact select:focus,
#contact select:active
{background-color: #FFC;}
#contact label.error {
line-height:1;
color:#F00;
background:#FFC;
padding:3px;
box-shadow:1px 2px 3px #333
/**hidden ids based on selection**/
#one,#two,#three,#four {
color: #03C;
font-weight:bold;
display:none;
</style>
</head>
<body>
<p>Conditional Form with jQuery Validation</p>
<!--begin form-->
<form id="contact" action="path/form-processing-script.php" method="post">
<fieldset>
<legend>Required Fields:</legend>
<ol>
<li><label for="first_name">Name:</label>
<input name="first_name" id="first_name" type="text" required placeholder="First"></li>
<li><label for="last_name">Last:</label>
<input name="last_name" id="last_name" type="text" required placeholder="Last"></li>
<li><label for="e_mail">E-mail:</label>
<input name="e_mail" id="e_mail" type="email" required placeholder="[email protected]"></li>
</ol>
</fieldset>
<fieldset>
<legend>Conditional Select - Required:</legend>
<ol>
<li><label for="MySelect">Select One:</label>
<select name="MySelect" id="MySelect" size="5" required title="Please select something!">
<option value="0">None</option>
<option value="1">Audi</option>
<option value="2">Saab</option>
<option value="3">Fiat</option>
<option value="4">BMW</option>
</select></li>
<!--hidden-->
<li id="one">
<label for="option1">You selected Audi:</label>
<input name="option1" id="option1" type="text" placeholder="Year and Model" />
</li>
<li id="two">
<label for="option2">You selected Saab:</label>
<input name="option2" id="option2" type="text" placeholder="Year and Model" />
</li>
<li id="three">
<label for="option3">You selected Fiat:</label>
<input name="option3" id="option3" type="text" placeholder="Year and Model" />
</li>
<li id="four">
<label for="option4">You selected BMW:</label>
<input name="option4" id="option4" type="text" placeholder="Year and Model" />
</li>
<!--end hidden fields-->
</ol>
</fieldset>
<fieldset>
<legend>Optional Fields:</legend>
<ol>
<li>
<label for="phone">Phone:</label>
<input name="phone" id="phone" type="number" placeholder="(area code) 123-4567" />
</li>
<li><label for="subject">Subject:</label>
<input name="subject" id="subject" type="text" />
</li>
<li><label for="message">Message:</label>
<textarea id="message" name="message" placeholder="remarks"></textarea>
</li>
<li><input name="submit" type="submit" value="Submit">
</li>
</ol>
</fieldset>
</form>
<!--end form-->
<!--form validation-->
<script>
$(document).ready(function() {
$("#contact").validate();
$("#MySelect").validate();
//Custom jQuery to show/hide input fields based on selected options//
$('#one,#two,#three,#four') .hide();
$('#MySelect').bind('change', function (e) {
if( $('#MySelect').val() == 1) {
$('#one').show('slow');
else{
$('#one').hide();
if( $('#MySelect').val() == 2) {
$('#two').show('slow');
else{
$('#two').hide();
if( $('#MySelect').val() == 3) {
$('#three').show('slow');
else{
$('#three').hide();
if( $('#MySelect').val() == 4) {
$('#four').show('slow');
else{
$('#four').hide();
</script>
</body>
</html>
Nancy O. -
Any way to fade out a popup?
I'm looking for a way to fade out a popup control. I can fade it in easy enough but can't figure out how to fade it out.
I tried adding an event handler on the onCloseRequest event but this isn't fired for popups.
I tried adding an event handler on the onHiding event which works but the popup is hidden before the animation even starts. I can't make the handler wait until the animation is finished before returning from the handler.
Thanks
CurtisI don't know if you're in a situation where you can use a subclass of Popup, but if so this will do the trick.
import java.util.HashMap;
import java.util.Map;
import javafx.animation.FadeTransition;
import javafx.animation.KeyFrame;
import javafx.animation.KeyValue;
import javafx.animation.Timeline;
import javafx.application.Application;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.ReadOnlyBooleanProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.layout.*;
import javafx.scene.paint.Color;
import javafx.scene.shape.*;
import javafx.stage.Popup;
import javafx.stage.Stage;
import javafx.stage.Window;
import javafx.util.Duration;
public class PopupFadeTransition extends Application {
public static void main(String[] args) {
launch(args);
@Override
public void start(final Stage primaryStage) throws Exception {
primaryStage.setTitle("Popup Example");
final FadePopup popup = new FadePopup();
popup.setHideOnEscape(true);
popup.setX(300);
popup.setY(200);
final Circle circle = new Circle(25, 25, 50, Color.RED);
final Rectangle rectangle = new Rectangle(20, 20, 20, 20);
rectangle.setFill(Color.GREEN);
popup.getContent().addAll(circle, rectangle);
Button show = new Button("Show");
show.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
popup.show(primaryStage);
Button hide = new Button("Hide");
hide.disableProperty().bind(popup.hidingProperty());
hide.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
popup.hide();
HBox layout = new HBox(10);
layout.setStyle("-fx-background-color: cornsilk; -fx-padding: 10;");
layout.getChildren().addAll(show, hide);
primaryStage.setScene(new Scene(layout));
primaryStage.show();
public class FadePopup extends Popup {
private final BooleanProperty hiding;
public FadePopup() {
this.hiding = new SimpleBooleanProperty(this, "hiding", false);
public ReadOnlyBooleanProperty hidingProperty() {
return hiding;
public boolean isHiding() {
return hiding.get();
@Override
public void hide() {
if (!hiding.get()) {
hiding.set(true);
final ObservableList<Node> nodes = this.getContent();
final Map<Node, Double> opacities = new HashMap<Node, Double>();
KeyValue[] keyValues = new KeyValue[nodes.size()];
for (int i = 0; i < keyValues.length; i++) {
Node node = nodes.get(i);
opacities.put(node, node.getOpacity());
keyValues[i] = new KeyValue(nodes.get(i).opacityProperty(), 0);
KeyFrame frame = new KeyFrame(Duration.seconds(1), keyValues);
Timeline timeline = new Timeline(frame);
timeline.setOnFinished(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
hiding.set(false);
FadePopup.super.hide();
for (Node node : nodes) {
node.setOpacity(opacities.get(node));
timeline.play();
} -
Using Javascript to hide objects that have no "binding" tab?
Hello,
I'm attempting to create a form that uses checkboxes to hide a variety of fields. I've run into a problem though; it seems that only text fields have a binding tab (unless I'm missing something). Is there a way for me to do show hides for images and text boxes? When I hold ctrl and hover over these items there is a small circle with a red line through it, which seems to express that it is impossible to manipulate them using javascript.
For the record, I'm using javascript as seen below:
BusinessDBAname.presence = "hidden";
If someone had any definite answers on this I'd really appreciate it.Hi,
sorry to say that, but this is a really bad form design.
There are a couple of things you can make it better.
1. Give unnamed subforms a suitable naming
2. Use subforms to organise your form
3. Don't embed fonts at all when you only use the default fonts Arial or Myriad Pro
4. Don't select the checkbox to embed images (they will get embedded always but this method requires more space)
5. Set option to prevent script changes in the form to automatically, otherwise the changes wont be saved
Ok, I suggest you to create a set of subforms to represent your Section 1 - 9.
In each subform you then add a subform for business and sole proprietor.
Into those subforms you then put the desired fields, images etc.
This allows you much shorter scriptings because you only have to change the presence of the surrounding subforms to show/hide an entire set of objects.
You form design finally should look something like this.
form1
Maserpage
PayeeSetupRequest
Section1
Business
Textfield1
Textfield5
SoleProprietor
Textfield1
Textfield3
Section2
Business
Textfield1
Textfield5
SoleProprietor
Textfield1
Textfield3
Section3
Hope this helps. -
Hide new/old value of bind variable in SQL*Plus
Hi,
I have a SQL*Plus script to create a new user. It asks for username & password and then passes these values to a SP to do some checks and finally create the user.
The output is currently the following :
New user will be created in ORCL LAB
Enter the requested username : fleet2
Enter the password for fleet2 : *****
Re-enter the password for fleet2 : *****
old 2: labadmin_cr_user('&username', '&pswd', '&pswd2');
new 2: labadmin_cr_user('fleet2', 'fleet', 'fleet');
The requested username is already in use in the database. Please choose another username.
As you can see the passwords are now exposed when the procedure is called. This is not what I want off course. I cannot do termout off as the serveroutput is not shown as well in that case. I use dbms_output to show error messages to users. (see example above in case of an existing user).
Can anybody tell me how to hide these 2 lines (old 2, new 2) without hiding my dbms_output.
Thanks!
Krisset verify offhttp://download-uk.oracle.com/docs/cd/B10501_01/server.920/a90842/ch13.htm#1013382
-
Hi All,
I faced an when using WPF Treeview Drag and Drop function. Firstly, I can achieve Drag and Drop in a general TreeViewItem. I followed this article in CodeProject: http://www.codeproject.com/Articles/55168/Drag-and-Drop-Feature-in-WPF-TreeView-Control
This scenario works for the TreeViewItem looks like below,
<TreeView x:Name="_countries" AllowDrop="True" MouseLeftButtonDown="OnTMouseDown">
<TreeViewItem Header="USA">
<TreeViewItem Header="New York"/>
<TreeViewItem Header="Canifonia"/>
<TreeViewItem Header="Sourth East">
<TreeViewItem Header="Houston"/>
<TreeViewItem Header="DAL"/>
<TreeViewItem Header="SAN"/>
</TreeViewItem>
</TreeViewItem>
<TreeViewItem Header="China">
<TreeViewItem Header="Beijing"/>
<TreeViewItem Header="Jiangsu">
<TreeViewItem Header="Nantong"/>
<TreeViewItem Header="Suzhou"/>
<TreeViewItem Header="Wuxi"/>
</TreeViewItem>
</TreeViewItem>
<TreeView.ItemContainerStyle>
<Style TargetType="TreeViewItem">
<EventSetter Event="TreeViewItem.DragOver" Handler="OnTDragOver"/>
<EventSetter Event="TreeViewItem.Drop" Handler="OnTDrop"/>
<EventSetter Event="TreeViewItem.MouseMove" Handler="OnTMouseMove"/>
</Style>
</TreeView.ItemContainerStyle>
</TreeView>
My Question is if i custom the TreeView Item like:
<TreeView.ItemTemplate>
<HierarchicalDataTemplate DataType="{x:Type local:QuestionInfo}" ItemsSource="{Binding Infos}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Path=Name}"/>
<TextBlock Text="{Binding Path=Score}"/>
</StackPanel>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
1. How to achieve the Drag and Drop function?
2. Since the data is binding to TreeView, When i Drag and Drop item. I want to keep the same order in my data source. In other words, If i drag the third TreeView Item to the first item.
3. How to change the Drag and Drop animation?
Could you please do me a favor?
Thanks a lot.Hello Ricky,
For question 1, "How to achieve the Drag and Drop function?"
I would recommend you read a blog from here:
http://wpftutorial.net/DragAndDrop.html?showallcomments
The important part of this code is the following line:
// Get the dragged ListViewItem
ListView listView = sender as ListView;
ListViewItem listViewItem =
FindAnchestor<ListViewItem>((DependencyObject)e.OriginalSource);
And the FindAnchestor is to find the parent of your selection:
// Helper to search up the VisualTree
private static T FindAnchestor<T>(DependencyObject current)
where T : DependencyObject
do
if( current is T )
return (T)current;
current = VisualTreeHelper.GetParent(current);
while (current != null);
return null;
Please consider the following scenario, if you have a textbox in a canvas, if you want to drag and drop your textbox, you are using the function about to search for it parent object, the canvas and then you are moving that canvas. In this way we can drag
and drop a item which may contains the textbox you mentioned.
A complete sample can be checked from a great blog below:
http://openszone.com/solution/how-to-accomplish-drag-and-drop-wpf-treeviewitem
And for the question about the Drag and Drop animation, do you mean you want to "create a preview effect for the operation"
If so, try this blog:http://blogs.msdn.com/b/marcelolr/archive/2006/03/03/showing-drag-drop-feedback-on-the-wpf-adorner-layer.aspx
The second question "data source", I think we can talk about it if you can share how you defined your datasource. That is more reasonable then just guess how your source will be filled into treeview.
Anyway, I would recommend you check Flankin's blog for some details about this.
Best regards,
Barry
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.
Maybe you are looking for
-
PopUp with selectMany List Box in JSF
Hi, am a newbie to JSF.... I have a page with a hyperlink which opens a popup that has two multi select list boxes (values need to be moved to and fro within select boxes). Then i have a select button in the popup which should send the selected value
-
I am working with a company that requires me to log in on a toolbar, but when I do, I get the error 'JSON request was malformed'. WTH does that mean and what can I do? Thanks!
-
Exch2010 Room Mailboxes - disable unautherized users to create Meeting Request
Hi all, This one is giving me a headache. I have created some Room Mailboxes which I all want to act the same, which is as followed: - Everyone (we have mailgroup with all users) has review rights - Certain users have editor rights - Resource Booking
-
My bookmarks are gone. How do I get them back?
A few days ago I noticed that about half my bookmarks were gone. Now they have all disappeared. How do I get them back?
-
Export pdf with completely flattened linked images/tables
Hello I am trying to export my thesis as pdf so that the illustrator images which are linked in, are flattened including their text labels. This document needs to be submitted to examiners who want to scan the word-count of the body text, not the ima