DetailsPane
This class is is tasked with controlling the modification of shapes.
Contents
classdef DetailsPane < handle
% This defines the DetailsPane class. % URL : $URL: $ % Log : $Id: DetailsPane.html,v 1.1 2008/07/23 12:51:19 jberg Exp $ % Copyright (c) 2008 The MathWorks, Inc.
Class Properties
properties ( Dependent = true )
selected_reference_CS; % (CoordSystem)
end
properties ( SetAccess = 'private', GetAccess = 'public' )
pane; % (javax.swing.JPanel)
ui_controls; % (javax.swing...)
end
properties ( SetAccess = 'private', GetAccess = 'private' )
bodyBuilder; % (BodyBuilder)
end
methods
Constructor
function obj = DetailsPane(bodyBuilder) % Load function handles fh = svSupport; % Build the Gui and set pane obj.bodyBuilder = bodyBuilder; obj.pane = obj.build_gui(fh); end
SET Methods
function set.bodyBuilder(obj, in) prop_name = 'bodyBuilder'; prop_type = 'BodyBuilder'; [valid_flag in] = Validate.SCALAR(in,'type',prop_type); if valid_flag obj.(prop_name) = in; end end function set.pane(obj, in) prop_name = 'pane'; prop_type = 'javax.swing.JPanel'; [valid_flag in] = Validate.SCALAR(in,'type',prop_type); if valid_flag obj.(prop_name) = in; end end
Public GET Methods
function ref_CS = get.selected_reference_CS(obj) the_selected_shape = obj.bodyBuilder.selected_shape; parent_shape = obj.bodyBuilder.selected_shape_parent; ui = obj.ui_controls; % Get the shape's coord systems curr_coord_systems = the_selected_shape.coord_system; % returns all coord_systems parent_coord_systems = parent_shape.coord_system; % Check what is the selected CS in the coordsystem_parent_combobox and see % if this can be a valid reference CS (check for the looping such that it % does not point back to this CS again). ref_CS_name = ui.coord_system_parent_combobox.getSelectedItem; if(strcmp(ref_CS_name,'World.Origin')) ref_CS = obj.bodyBuilder.body.coord_system{1}.reference_CS; else [ref_CS_shape_name ref_CS_csname] = strtok(ref_CS_name,'.'); if(isempty(ref_CS_csname)) % There is no dot in the name (i.e., it belongs to the selected shape) refname_str = ref_CS_shape_name; ii = 1; while(ii <= length(curr_coord_systems)) if(strcmp(refname_str,curr_coord_systems{ii}.name)) ref_CS = curr_coord_systems{ii}; break; else ii = ii+1; end end elseif(strcmp(ref_CS_shape_name,parent_shape.name)) refname_str = ref_CS_csname(2:end); ii = 1; while(ii <= length(parent_coord_systems)) if(strcmp(refname_str,parent_coord_systems{ii}.name)) ref_CS = parent_coord_systems{ii}; break; else ii = ii+1; end end else error(['Cannot identify selected Reference CS. This condition' ... ' should not occur']); end end end
Public HELPER Methods
function update_geometry_panel(obj,dimension_info) the_shape = obj.bodyBuilder.selected_shape; ui = obj.ui_controls; the_edit_names = {... 'geometry_dim_1_editbox' 'geometry_dim_2_editbox' 'geometry_dim_3_editbox'}; the_label_names = {... 'geometry_dim_1_label' 'geometry_dim_2_label' 'geometry_dim_3_label'}; n_dim = size(dimension_info,1); req_units = get(ui.geometry_units_combobox,'SelectedItem'); dim_values = DetailsPane.convert_from_MKSUnits([dimension_info{:,2}],req_units); for ii = 1:n_dim ui.(the_label_names{ii}).setText(dimension_info{ii,1}); ui.(the_label_names{ii}).setVisible(true); ui.(the_edit_names{ii}).setText(num2str(dim_values(ii))); ui.(the_edit_names{ii}).setVisible(true); end for ii = n_dim+1:length(the_edit_names) ui.(the_label_names{ii}).setVisible(false); ui.(the_edit_names{ii}).setVisible(false); end if isa(the_shape,'ComplexShape') ui.geometry_units_combobox.setVisible(false); else ui.geometry_units_combobox.setVisible(true); end end function update_coordSystem_panel(obj,the_selected_shape, the_parent_shape) ui = obj.ui_controls; % Load up combobox with available coordinate systems the_cs = the_selected_shape.coord_system; the_parent_cs = the_parent_shape.coord_system; the_combobox = ui.coord_system_selection_combobox; the_parent_CS_combobox = ui.coord_system_parent_combobox; % remove existing coord_systems if any DetailsPane.silent_removeAllItems(the_combobox); DetailsPane.silent_removeAllItems(the_parent_CS_combobox); % Add coord_system names to the parent coordsystem combobox % First add the global origin DetailsPane.silent_addItem(the_parent_CS_combobox,'World.Origin'); parent_CS_names{1} = 'World.Origin'; % add coord_systems of the parent shape to the % parent_coord_system_combobox if the parent shape is not same as the % selected shape (happens for the top level complex shape) if(the_selected_shape~=the_parent_shape) for ii = 1:length(the_parent_cs) the_name = [the_parent_shape.name '.' the_parent_cs{ii}.name]; % the_name = the_parent_cs{ii}.name; DetailsPane.silent_addItem(the_parent_CS_combobox,the_name); parent_CS_names{end+1} = the_name; %#ok<AGROW> end end % add coord_systems of the selected shape to both the % coord_system_selection_combobox and the parent_coord_system_combobox for ii = 1:length(the_cs) the_name = the_cs{ii}.name; DetailsPane.silent_addItem(the_combobox,the_name); DetailsPane.silent_addItem(the_parent_CS_combobox,the_name); parent_CS_names{end+1} = the_name; %#ok<AGROW> end % select the first coord_system the_combobox.setSelectedIndex(0); end
end methods ( Access = 'public' , Static = true)
Public Static HELPER Methods
function out_values = convert_to_MKSUnits(in_values, in_units) switch lower(in_units) % Position Units case 'm' out_values = in_values; case 'cm' out_values = in_values/100; case 'mm' out_values = in_values/1000; case 'ft' out_values = in_values*0.3048; case 'in' out_values = in_values*0.0254; otherwise error('Unknown units.'); end end function out_values = convert_from_MKSUnits(in_values, req_units) switch lower(req_units) % Position Units case 'm' out_values = in_values; case 'cm' out_values = in_values*100; case 'mm' out_values = in_values*1000; case 'ft' out_values = in_values/0.3048; case 'in' out_values = in_values/0.0254; otherwise error('Unknown units.'); end end
end methods ( Access = 'private' )
Private HELPER Methods
function pane = build_gui(obj,fh) import java.awt.GridLayout; import java.awt.BorderLayout; import javax.swing.BorderFactory; % ============================================================== % DETAILS_PANE CONSISTS OF: % 1. JTabbedPane (Details Panels) geometry_panel = obj.make_geometry_panel(fh); coord_panel = obj.make_coord_panel(fh); material_panel = obj.make_material_panel(fh); tabbedPane = javaObjectEDT('javax.swing.JTabbedPane'); tabbedPane.addTab( 'Geometry', geometry_panel ); tabbedPane.addTab( 'Coordinate Systems', coord_panel ); tabbedPane.addTab( 'Material Properties', material_panel ); % ============================================================== % DETAILS_PANE pane = javaObjectEDT('javax.swing.JPanel',GridLayout); pane.setBorder(BorderFactory.createTitledBorder... ('Shape Details')); pane.add(tabbedPane, BorderLayout.CENTER); end function new_obj = create_combobox(obj,callback,is_enabled,str_list) new_obj = javaObjectEDT('javax.swing.JComboBox'); new_obj.setEnabled(is_enabled); for ii = 1:length(str_list) new_obj.addItem(str_list{ii}); end new_obj.setAlignmentX(new_obj.LEFT_ALIGNMENT); if(~isempty(callback)) set(handle(new_obj, 'CallbackProperties'),... 'ActionPerformedCallback', {callback,obj}); % 'ComponentAddedCallback', {callback,obj}); % 'ComponentRemovedCallback', {callback,obj}); % 'ItemStateChangedCallback', {callback,obj}); % 'FocusGainedCallback', {callback,obj}); % 'FocusLostCallback', {callback,obj}); % 'HierarchyChangedCallback', {callback,obj}); % 'CaretPositionChangedCallback', {callback,obj}); % 'PropertyChangeCallback', {callback,obj}); % 'KeyPressedCallback', {callback,obj}); % 'KeyReleasedCallback', {callback,obj}); end end function new_obj = create_editbox(obj,def_string,callback,is_enabled,param_1) new_obj = javaObjectEDT('javax.swing.JTextField',def_string,10); new_obj.setEditable(is_enabled); new_obj.setHorizontalAlignment(new_obj.CENTER); h_new_obj_CallbackProperties = handle(new_obj, 'CallbackProperties'); if nargin < 5 set(h_new_obj_CallbackProperties,'ActionPerformedCallback',{callback,obj}); set(h_new_obj_CallbackProperties,'KeyTypedCallback',{callback,obj}); else set(h_new_obj_CallbackProperties,'ActionPerformedCallback',{callback,obj,param_1}); set(h_new_obj_CallbackProperties,'KeyTypedCallback',{callback,obj,param_1}); end end function the_panel = make_geometry_panel(obj,fh) import java.awt.*; import javax.swing.table.*; % ============================================================== % Geometry Panel consists of: the_panel = javaObjectEDT('javax.swing.JPanel',GridBagLayout); % ============================================================== % Geometry System Panel consists of: % First Row % 1. (label) ui_11 = javaObjectEDT('javax.swing.JLabel','Dim 1: '); gb = GridBagConstraints; gb.gridx = 0; gb.gridy = 0; gb.fill = gb.BOTH; gb.insets = Insets(5,5,5,5); the_panel.add(ui_11,gb); % 2. (editbox) First Dimension ui_12 = obj.create_editbox('',... fh.geometry_editbox_ActionPerformedCallback,true,1); gb = GridBagConstraints; gb.gridx = 1; gb.gridy = 0; gb.fill = gb.BOTH; gb.insets = Insets(5,5,5,5); the_panel.add(ui_12,gb); % 3. (combobox) Location Units str_list = {'m', 'cm', 'mm', 'ft', 'in'}; ui_13 = obj.create_combobox(... fh.geometry_units_selection_combobox_ActionPerformedCallback,true,str_list); gb = GridBagConstraints; gb.gridx = 2; gb.gridy = 0; gb.fill = gb.BOTH; gb.insets = Insets(5,5,5,5); the_panel.add(ui_13,gb); % Second Row % 1. (label) ui_21 = javaObjectEDT('javax.swing.JLabel','Dim 2: '); gb = GridBagConstraints; gb.gridx = 0; gb.gridy = 1; gb.fill = gb.BOTH; gb.insets = Insets(5,5,5,5); the_panel.add(ui_21,gb); % 2. (editbox) Second Dimension ui_22 = obj.create_editbox('',... fh.geometry_editbox_ActionPerformedCallback,true,2); gb = GridBagConstraints; gb.gridx = 1; gb.gridy = 1; gb.fill = gb.BOTH; gb.insets = Insets(5,5,5,5); the_panel.add(ui_22,gb); % Third Row % 1. (label) ui_31 = javaObjectEDT('javax.swing.JLabel','Dim 3: '); gb = GridBagConstraints; gb.gridx = 0; gb.gridy = 2; gb.fill = gb.BOTH; gb.insets = Insets(5,5,5,5); the_panel.add(ui_31,gb); % 2. (editbox) Third Dimension ui_32 = obj.create_editbox('',... fh.geometry_editbox_ActionPerformedCallback,true,3); gb = GridBagConstraints; gb.gridx = 1; gb.gridy = 2; gb.fill = gb.BOTH; gb.insets = Insets(5,5,5,5); the_panel.add(ui_32,gb); % Update the UI objects ui = obj.ui_controls; ui.geometry_dim_1_label = ui_11; ui.geometry_dim_1_editbox = ui_12; ui.geometry_units_combobox = ui_13; ui.geometry_dim_2_label = ui_21; ui.geometry_dim_2_editbox = ui_22; ui.geometry_dim_3_label = ui_31; ui.geometry_dim_3_editbox = ui_32; obj.ui_controls = ui; end function the_panel = make_coord_panel(obj,fh) import java.awt.*; import javax.swing.table.*; % ============================================================== % Coord System Panel consists of: the_panel = javaObjectEDT('javax.swing.JPanel',GridBagLayout); % ============================================================== % Coord System Panel consists of: % 1. (Combobox) Coordinate System Selection str_list = cell(0); % First Row % 1. Label tempLabel = javaObjectEDT('javax.swing.JLabel','Set CoordSys'); tempLabel.setHorizontalAlignment(tempLabel.CENTER) gb = GridBagConstraints; gb.gridx = 1; gb.gridy = 0; gb.fill = gb.BOTH; gb.insets = Insets(5,5,5,5); the_panel.add(tempLabel,gb); % 2. Combobox ui_11 = obj.create_combobox(... fh.coord_system_selection_combobox_ActionPerformedCallback,true,str_list); h_ui_11_CallbackProperties = handle(ui_11, 'CallbackProperties'); set(h_ui_11_CallbackProperties,'MouseEnteredCallback',... {fh.coord_system_highlight,obj,true}); set(h_ui_11_CallbackProperties,'MouseExitedCallback',... {fh.coord_system_highlight,obj,false}); gb = GridBagConstraints; gb.gridx = 2; gb.gridy = 0; gb.fill = gb.BOTH; gb.insets = Insets(5,5,5,5); the_panel.add(ui_11,gb); % 3. Label ui_12 = javaObjectEDT('javax.swing.JLabel','wrt Reference CS'); ui_12.setHorizontalAlignment(ui_12.CENTER) gb = GridBagConstraints; gb.gridx = 3; gb.gridy = 0; gb.fill = gb.BOTH; gb.insets = Insets(5,5,5,5); the_panel.add(ui_12,gb); % 4. Combobox ui_13 = obj.create_combobox(... fh.coord_system_parent_combobox_ActionPerformedCallback,true,str_list); % set(ui_13,'MouseEnteredCallback',... % {fh.coord_system_parent_highlight,obj,true}); % set(ui_13,'MouseExitedCallback',... % {fh.coord_system_parent_highlight,obj,false}); % set(ui_13,'MouseClickedCallback',... % {fh.coord_system_parent_combobox_MouseClickedCallback,obj}); gb = GridBagConstraints; gb.gridx = 4; gb.gridy = 0; gb.fill = gb.BOTH; gb.insets = Insets(5,5,5,5); the_panel.add(ui_13,gb); % Second Row % 1. Label tempLabel = javaObjectEDT('javax.swing.JLabel','X'); tempLabel.setHorizontalAlignment(tempLabel.CENTER) gb = GridBagConstraints; gb.gridx = 1; gb.gridy = 1; gb.fill = gb.BOTH; gb.insets = Insets(5,5,5,5); the_panel.add(tempLabel,gb); % 2. Label tempLabel = javaObjectEDT('javax.swing.JLabel','Y'); tempLabel.setHorizontalAlignment(tempLabel.CENTER) gb = GridBagConstraints; gb.gridx = 2; gb.gridy = 1; gb.fill = gb.BOTH; gb.insets = Insets(5,5,5,5); the_panel.add(tempLabel,gb); % 3. Label tempLabel = javaObjectEDT('javax.swing.JLabel','Z'); tempLabel.setHorizontalAlignment(tempLabel.CENTER) gb = GridBagConstraints; gb.gridx = 3; gb.gridy = 1; gb.fill = gb.BOTH; gb.insets = Insets(5,5,5,5); the_panel.add(tempLabel,gb); % Third Row % 1. Label tempLabel = javaObjectEDT('javax.swing.JLabel','Position'); gb = GridBagConstraints; gb.gridx = 0; gb.gridy = 2; gb.fill = gb.BOTH; gb.insets = Insets(5,5,5,5); the_panel.add(tempLabel,gb); % 2. (edit) X-Position ui_31 = obj.create_editbox('',... fh.coord_system_editbox_ActionPerformedCallback,true,'x_pos'); gb = GridBagConstraints; gb.gridx = 1; gb.gridy = 2; gb.fill = gb.BOTH; gb.insets = Insets(5,5,5,5); the_panel.add(ui_31,gb); % 3. (edit) Y-Position ui_32 = obj.create_editbox('',... fh.coord_system_editbox_ActionPerformedCallback,true,'y_pos'); gb = GridBagConstraints; gb.gridx = 2; gb.gridy = 2; gb.fill = gb.BOTH; gb.insets = Insets(5,5,5,5); the_panel.add(ui_32,gb); % 4. (edit) Z-Position ui_33 = obj.create_editbox('',... fh.coord_system_editbox_ActionPerformedCallback,true,'z_pos'); gb = GridBagConstraints; gb.gridx = 3; gb.gridy = 2; gb.fill = gb.BOTH; gb.insets = Insets(5,5,5,5); the_panel.add(ui_33,gb); % 5. (combobox) Location Units str_list = {'m', 'cm', 'mm', 'ft', 'in'}; ui_34 = obj.create_combobox(... fh.coord_units_selection_combobox_ActionPerformedCallback,true,str_list); gb = GridBagConstraints; gb.gridx = 4; gb.gridy = 2; gb.fill = gb.BOTH; gb.insets = Insets(5,5,5,5); the_panel.add(ui_34,gb); % 6. (pushbutton) Add a coord system add_Button = javaObjectEDT('javax.swing.JButton','+'); add_Button.setEnabled(true); gb = GridBagConstraints; gb.gridx = 5; gb.gridy = 2; gb.fill = gb.BOTH; gb.insets = Insets(5,5,5,5); set(handle(add_Button, 'CallbackProperties'),'ActionPerformedCallback', ... {fh.add_coord_button_ActionPerformedCallback,obj}); the_panel.add(add_Button,gb); % Fourth Row % 1. Label tempLabel = javaObjectEDT('javax.swing.JLabel','Orientation'); gb = GridBagConstraints; gb.gridx = 0; gb.gridy = 3; gb.fill = gb.BOTH; gb.insets = Insets(5,5,5,5); the_panel.add(tempLabel,gb); % 2. (edit) X-Rotation ui_41 = obj.create_editbox('',... fh.coord_system_editbox_ActionPerformedCallback,true,'x_rot'); gb = GridBagConstraints; gb.gridx = 1; gb.gridy = 3; gb.fill = gb.BOTH; gb.insets = Insets(5,5,5,5); the_panel.add(ui_41,gb); % 3. (edit) Y-Rotation ui_42 = obj.create_editbox('',... fh.coord_system_editbox_ActionPerformedCallback,true,'y_rot'); gb = GridBagConstraints; gb.gridx = 2; gb.gridy = 3; gb.fill = gb.BOTH; gb.insets = Insets(5,5,5,5); the_panel.add(ui_42,gb); % 4. (edit) Z-Rotation ui_43 = obj.create_editbox('',... fh.coord_system_editbox_ActionPerformedCallback,true,'z_rot'); gb = GridBagConstraints; gb.gridx = 3; gb.gridy = 3; gb.fill = gb.BOTH; gb.insets = Insets(5,5,5,5); the_panel.add(ui_43,gb); % 5. Label tempLabel = javaObjectEDT('javax.swing.JLabel',BodyBuilder.rotation_type); gb = GridBagConstraints; gb.gridx = 4; gb.gridy = 3; gb.fill = gb.BOTH; gb.insets = Insets(5,5,5,5); the_panel.add(tempLabel,gb); % 6. (pushbutton) Remove a coord system remove_Button = javaObjectEDT('javax.swing.JButton','-'); remove_Button.setEnabled(true); gb = GridBagConstraints; gb.gridx = 5; gb.gridy = 3; gb.fill = gb.BOTH; gb.insets = Insets(5,5,5,5); set(handle(remove_Button, 'CallbackProperties'),... 'ActionPerformedCallback', ... {fh.remove_coord_button_ActionPerformedCallback,obj}); the_panel.add(remove_Button,gb); % Update the UI objects ui = obj.ui_controls; ui.coord_system_selection_combobox = ui_11; ui.coord_system_parentname_label = ui_12; ui.coord_system_parent_combobox = ui_13; ui.coord_system_x_pos_editbox = ui_31; ui.coord_system_y_pos_editbox = ui_32; ui.coord_system_z_pos_editbox = ui_33; ui.coord_system_units_combobox = ui_34; ui.coord_system_x_rot_editbox = ui_41; ui.coord_system_y_rot_editbox = ui_42; ui.coord_system_z_rot_editbox = ui_43; obj.ui_controls = ui; end function the_panel = make_material_panel(obj,fh) import java.awt.*; import javax.swing.table.*; the_panel = javaObjectEDT('javax.swing.JPanel',GridBagLayout); % ============================================================== % Material Panel consists of: % 1. (Combobox) Name of the ShapeMaterial % 2. (edit; disabled) Density % 3. (edit; disabled) Youngs Modulus % 4. (edit; disabled) Poissons Ratio % First Row % 1. Label tempLabel = javaObjectEDT('javax.swing.JLabel','Select Material'); gb = GridBagConstraints; gb.gridx = 0; gb.gridy = 0; gb.fill = gb.BOTH; gb.insets = Insets(5,5,5,5); the_panel.add(tempLabel,gb); % 2. (Combobox) Name of the ShapeMaterial % Load up Combobox with available materials the_materials = obj.bodyBuilder.materials; mtl_names = cell(length(the_materials),1); for ii = 1:length(the_materials) mtl_names{ii} = the_materials{ii}.material_name; end ui_11 = obj.create_combobox(... fh.material_selection_combobox_ActionPerformedCallback,false,mtl_names); gb = GridBagConstraints; gb.gridx = 1; gb.gridy = 0; gb.fill = gb.BOTH; gb.insets = Insets(5,5,5,5); the_panel.add(ui_11,gb); % Second Row % 1. Label tempLabel = javaObjectEDT('javax.swing.JLabel','Density'); gb = GridBagConstraints; gb.gridx = 0; gb.gridy = 1; gb.fill = gb.BOTH; gb.insets = Insets(5,5,5,5); the_panel.add(tempLabel,gb); % 2. (edit; disabled) Density ui_21 = obj.create_editbox('','',false); gb = GridBagConstraints; gb.gridx = 1; gb.gridy = 1; gb.fill = gb.BOTH; gb.insets = Insets(5,5,5,5); the_panel.add(ui_21,gb); % 3. Label tempLabel = javaObjectEDT('javax.swing.JLabel','Kg/m3'); gb = GridBagConstraints; gb.gridx = 2; gb.gridy = 1; gb.fill = gb.BOTH; gb.insets = Insets(5,5,5,5); the_panel.add(tempLabel,gb); % Third Row % 1. Label tempLabel = javaObjectEDT('javax.swing.JLabel','Young''s Modulus'); gb = GridBagConstraints; gb.gridx = 0; gb.gridy = 2; gb.fill = gb.BOTH; gb.insets = Insets(5,5,5,5); the_panel.add(tempLabel,gb); % 2. (edit; disabled) Youngs Modulus ui_31 = obj.create_editbox('','',false); gb = GridBagConstraints; gb.gridx = 1; gb.gridy = 2; gb.fill = gb.BOTH; gb.insets = Insets(5,5,5,5); the_panel.add(ui_31,gb); % 3. Label tempLabel = javaObjectEDT('javax.swing.JLabel','MPa'); gb = GridBagConstraints; gb.gridx = 2; gb.gridy = 2; gb.fill = gb.BOTH; gb.insets = Insets(5,5,5,5); the_panel.add(tempLabel,gb); % Fourth Row % 1. Label tempLabel = javaObjectEDT('javax.swing.JLabel','Poisson''s Ratio'); gb = GridBagConstraints; gb.gridx = 0; gb.gridy = 3; gb.fill = gb.BOTH; gb.insets = Insets(5,5,5,5); the_panel.add(tempLabel,gb); % 2. (edit; disabled) Poissons Ratio ui_41 = obj.create_editbox('','',false); gb = GridBagConstraints; gb.gridx = 1; gb.gridy = 3; gb.fill = gb.BOTH; gb.insets = Insets(5,5,5,5); the_panel.add(ui_41,gb); % Update the UI objects ui = obj.ui_controls; ui.material_selection_combobox = ui_11; ui.material_density_editbox = ui_21; ui.material_youngs_editbox = ui_31; ui.material_poissons_editbox = ui_41; obj.ui_controls = ui; end
end methods ( Access = 'private', Static = true )
Static Private HELPER Methods
function silent_addItem(guiobj,item) % This avoid unnecessary triggering of the object's % ActionPerformedCallback callback, disable the callback until we % are ready to leave. the_callback = get(handle(guiobj,'CallbackProperties'),... 'ActionPerformedCallback'); DetailsPane.disable_ActionPerformedCallback(guiobj); guiobj.addItem(item); DetailsPane.reenable_ActionPerformedCallback(guiobj,the_callback); end function silent_setSelectedIndex(guiobj,idx) % This avoid unnecessary triggering of the object's % ActionPerformedCallback callback, disable the callback until we % are ready to leave. the_callback = get(handle(guiobj,'CallbackProperties'),... 'ActionPerformedCallback'); DetailsPane.disable_ActionPerformedCallback(guiobj); guiobj.setSelectedIndex(idx); DetailsPane.reenable_ActionPerformedCallback(guiobj,the_callback); end function silent_removeAllItems(guiobj) % This avoid unnecessary triggering of the object's % ActionPerformedCallback callback, disable the callback until we % are ready to leave. the_callback = get(handle(guiobj,'CallbackProperties'),... 'ActionPerformedCallback'); DetailsPane.disable_ActionPerformedCallback(guiobj); guiobj.removeAllItems; DetailsPane.reenable_ActionPerformedCallback(guiobj,the_callback); end function disable_ActionPerformedCallback(guiobj) set(handle(guiobj, 'CallbackProperties'),'ActionPerformedCallback',[]); end function reenable_ActionPerformedCallback(guiobj,the_callback) set(handle(guiobj, 'CallbackProperties'),... 'ActionPerformedCallback',the_callback); end
end
end