Welcome, Guest. Please login or register.
Did you miss your activation email?
Oct. 12, 2008, 05:09:41 AM
47679 Posts in 10457 Topics by 5342 Members
Latest Member: vihuarar
News: New to PRADO? The PRADO blog tutorial is a good start point.
 
The PRADO Community » Prado v3.x » Component Repository » TabPanel « previous next »
Pages: [1] 2 Print
Author Topic: TabPanel  (Read 4212 times)
Lourival Júnior
Senior Member
***

Karma: 8
Offline Offline

Posts: 62


It's me :)


View Profile
« on: Nov. 27, 2006, 07:26:36 PM »

Hi All!

I've done a component TabPanel based on this project: http://webfx.eae.net/dhtml/tabpane/tabpane.html.

The usage is:

Code:
<com:TabPanel ID="MyTabPanel" Mode="Default">
       <com:TabPage ID="MyTabPage1" Text="Tab 1">
                  Content goes here
       </com:TabPage>
       <com:TabPage ID="MyTabPage2" Text="Tab 2">
                  Content goes here
       </com:TabPage>
</com:TabPanel>

It's working for tabs. But I dont know why the content dont renders  Sad.

Please, I done this component coping and pasting some codes from others components that I've seen here. I want suggestions to finalize and improve it. Be free to change the code.

That's all.
Logged
durgis
Senior Member
***

Karma: 20
Offline Offline

Posts: 344


View Profile
« Reply #1 on: Nov. 27, 2006, 10:01:19 PM »

I did this in application.xml file:

<paths>
    <using namespace="Application.Components.*" />
  </paths>

Inside that folder I put your component file. But it fails. I've tried your solutions too, but I still got errors. I've tried others components using this configuration, and they work. Have you any other ideia?

I am getting the same results with your components... what OS are you running? There must be an encoding difference...

Yes, it's definitley file encoding or something. When I copy the text of your files into new ones, they work just fine. But the do not work as they are.
« Last Edit: Nov. 27, 2006, 10:18:21 PM by durgis » Logged
Lourival Júnior
Senior Member
***

Karma: 8
Offline Offline

Posts: 62


It's me :)


View Profile
« Reply #2 on: Nov. 28, 2006, 11:59:38 AM »

I've finished my component. Now it's working  Smiley. The usage is:

Code:
<com:TabPanel ID="MyTabPanel1" Mode="Windows">
<com:TabPage ID="TabPage1" Text="Tab1">
Content One!
</com:TabPage>
<com:TabPage ID="TabPage2" Text="Tab2">
Content Two!
</com:TabPage>
<com:TabPage ID="TabPage3" Text="Tab3">
<com:TabPanel ID="MyTabPanel2" Mode="Windows">
<com:TabPage ID="TabPage11" Text="Tab1">
Content One with a TLabel <com:TLabel Text="here"></com:TLabel>!
</com:TabPage>
<com:TabPage ID="TabPage12" Text="Tab2">
Content Two!
</com:TabPage>
</com:TabPanel>
</com:TabPage>
</com:TabPanel>

Where the Mode property could be Windows, WebFX and the default layout. To make it working put the file TabPanel.php in your protected directory, set the application.xml properly, and put the directory TabPanel in the same directory level of your index.php

I hope you enjoy it. Changes and suggestions will be accepted Smiley
Logged
durgis
Senior Member
***

Karma: 20
Offline Offline

Posts: 344


View Profile
« Reply #3 on: Nov. 28, 2006, 03:11:34 PM »

Just a simple suggestion:

If you use publishAsset then you do not need to have the TabPanel directory outside of the protected directory; then the component just works "out of the box" without altering any directory structure.

These are the only changes I would make; notice the use of publishAsset for the js, css, and png files:
Code:

const STYLE_SHEET_DIR = 'TabPanel/css/';
const JAVASCRIPT_DIR = 'TabPanel/js/';

public function onInit($param)
{
parent::onInit($param);

if( ($CssFile=$this->getCssFile())==='' ){
$mode = ($this->Mode) ? $this->Mode : null;

switch ($mode){
case "Windows":
$CssFile=$this->publishAsset(self::STYLE_SHEET_DIR.'tab.winclassic.css');
break;
case "WebFX":
$CssFile=$this->publishAsset(self::STYLE_SHEET_DIR.'tab.webfx.css');
break;
default:
$CssFile=$this->publishAsset(self::STYLE_SHEET_DIR.'luna/tab.css');
$this->publishAsset(self::STYLE_SHEET_DIR.'luna/tab.active.png');
$this->publishAsset(self::STYLE_SHEET_DIR.'luna/tab.hover.png');
$this->publishAsset(self::STYLE_SHEET_DIR.'luna/tab.png');
break;
      }
      $this->setCssFile($CssFile);
   }     
 
 
if( ($JSFile=$this->getJSFile())===''){
$JSFile=$this->publishAsset(self::JAVASCRIPT_DIR.'tabpane.js');
$this->setJSFile($CssFile);
}
         
$csm = $this->getPage()->getClientScript();
if(!$csm->isStyleSheetFileRegistered('tabpanel'))
$csm->registerStyleSheetFile('tabpanel', $CssFile,'screen');
if(!$csm->isScriptFileRegistered('tabpanel'))
$csm->registerScriptFile('tabpanel', $JSFile);
}

Oh yes, and a mod to setCssFile and setJSFile functions:
Code:
/**
* @param string TabPanel CssFile
*/
public function setCssFile($value)
{
$this->setViewState('CssFile',TPropertyValue::ensureString($value),'');
}

...

/**
* @param string TabPanel JSFile
*/
public function setJSFile($value)
{
$this->setViewState('JSFile',TPropertyValue::ensureString($value),'');
}
Logged
Lourival Júnior
Senior Member
***

Karma: 8
Offline Offline

Posts: 62


It's me :)


View Profile
« Reply #4 on: Nov. 28, 2006, 06:34:44 PM »

Dear durgis,

Thanks for your suggestions! In fact this is the better way to publish the component's files. The modifications are attached.

Please, if someone have any other suggestion or modifications be free to post here.

Regards
Logged
durgis
Senior Member
***

Karma: 20
Offline Offline

Posts: 344


View Profile
« Reply #5 on: Nov. 28, 2006, 06:47:59 PM »

Welcome,

Karma ++
Logged
gori
Senior Member
***

Karma: 12
Offline Offline

Posts: 119



View Profile WWW
« Reply #6 on: Nov. 30, 2006, 02:05:07 PM »

Hi. Your component is very useful Smiley Can you add Active (Ajax) functionality to it? As for me it will be great to use dynamic hiding/showing of panels..

Thanks in advance.
Logged

+1 Carma will be great Smiley http://prado-ua.com
Lourival Júnior
Senior Member
***

Karma: 8
Offline Offline

Posts: 62


It's me :)


View Profile
« Reply #7 on: Dec. 01, 2006, 11:30:06 AM »

Hi. Thanks for your comment  Smiley. The Ajax functionality I will take a time to do because I have study how to do what you want. Who knows someone can help us in how we can do this. I was thing about the Dojo library. There is a lot of component there that could be ported to a Prado component. Take a look and thing about Smiley

Regards!
Logged
wiktor
Senior Member
***

Karma: 2
Offline Offline

Posts: 52



View Profile
« Reply #8 on: Dec. 01, 2006, 12:00:54 PM »

Thanks for the component. It's really great!
Logged
drigolin
Junior Member
**

Karma: 4
Offline Offline

Posts: 49



View Profile
« Reply #9 on: Dec. 14, 2006, 04:15:30 PM »

I don't know why you didn't add the Javascript calls needed to use WebFX tab panel at best.
Whitout them at every postback you will see tab panal flashing until your browser will do the final rendering appling stylesheet.
This can make the user interaction really bad.

I'm modifing the tabpanel to invoke right methods:
tp1 = new WebFXTabPane( document.getElementById( "tabPane1" ) );

and for every tab page:
tp1.addTabPage( document.getElementById( "tabPage2" ) );

I added couple of properties:

Persistent: (boolean)
If true, the first page will be selected when isn't a postback.

UseCookies: (boolean)
If the tab status should be persisted into cookies or not.

I'm looking to add a property to TabPanel to explicit set the selected TabPage.
Stay tuned...

Logged
drigolin
Junior Member
**

Karma: 4
Offline Offline

Posts: 49



View Profile
« Reply #10 on: Dec. 14, 2006, 04:32:12 PM »

Some small fixes...
Logged
Lourival Júnior
Senior Member
***

Karma: 8
Offline Offline

Posts: 62


It's me :)


View Profile
« Reply #11 on: Dec. 14, 2006, 05:02:46 PM »

Hi drigolin!

Thanks for your improvements. Be free to change what you thing is wrong. I wrote this component in a feel hours, so problems are normal. But with it, more people from the community can modify and suggest more improvements.

Regards!
Logged
asdf
Newbie
*

Karma: 0
Offline Offline

Posts: 1


View Profile
« Reply #12 on: Jan. 24, 2007, 07:59:05 AM »

thank's to all of you

this is the one of great prado's component
 Grin
Logged
rickware
Junior Member
**

Karma: 1
Offline Offline

Posts: 12



View Profile
« Reply #13 on: Jan. 24, 2007, 08:06:35 PM »

cool,

keep it up!

 Grin Grin Grin

/* brazuca mandando ver */
Logged

®©®
daab
Junior Member
**

Karma: 0
Offline Offline

Posts: 27


Venezuela


View Profile
« Reply #14 on: Apr. 01, 2007, 11:01:35 PM »

Hi all,

nice work

How make:    Huh

$this->MyTabPanel->setSelectedIndex(1);

drigolin said: I'm looking to add a property to TabPanel to explicit set the selected TabPage. When?

thanks

daab
Logged
Pages: [1] 2 Print 
« previous next »
Jump to: