P

anel controls are most often used as—and are intended as—containers for other controls. They're often useful when you want to show or hide a group of controls at once, or when you want to add controls to a Web page in code. The figure below show four panels top, left, bottom and right

Figure: panels view

Design issues:

Panel control is very straightforward for designs no need for more details with it feature just because the main function of the panel is to contain other controls to be convention for move them, hiding, or showing them, all what we need then just to implement html container that can contain many nested element here we going to use the Div element and the nested children tag consider as div tag also.

v  Main methods of panel:

1-   SetWidth: Just to set the width size of the panel nothing else , the getWidth function return the width of the panel  as integer value.

2-   SetHeight : set the height of panel control

3-   Set size : set the width and height of panel control

4-   Set margin left : locate the position of the panel control  in x  form the left to the right of screen

5-   Set margin top : locate the position of the panel in y from top to bottom of the screen

6-    Set margin: set the margin left and top of the panel control

7-   Set visibility: just control the visibility of the panel control mean when to show it in screen and when to hide it off.

8-   Set background :   the port to set the background feature of the control panel

9-   Set border: make the panel more customizable, showing line border with size color and other border type features like dotted border, dashed border...act

10-    Add function: the most important ever, so as it suggested name the just is port for the panel container to put children inside in hierarchal way.

v  Css view of panel control:

J

ust because we will control the features of the panel using java script so no need to set the more sheet and attributes in the css file, according to what the control need features as default, just wrote the default ones see the code source below

The code beside show only the position of the control, padding and the border

Code: css file code of the panel control

v  Java script aspects:

Using java script to control the auto generation html code, mean we try to create all html elements using js code

·         Sizing control: that is to say how to set the size (width, height) of the control, object below is the div html element that we can consider it as panel control

  this.setWidth=function(val)
  {
   w=val;
   obj.style.width=w;
  }
  
this.getWidth=function(){return w;}
  
this.setHeight=function(val)
  {
   obj.style.height=val;
   h=val;
  }
  
this.getHeight=function(){return h;}
  
this.setMarginLeft=function(val)
  {
   l=val;obj.style.marginLeft=val;
  }

·         Margining: the margining property intended for layout of the controls, where to put the control in from, page or document.

  this.setMarginLeft=function(val)
  {
   l=val;obj.style.marginLeft=val;
  }
  
this.getMarginLeft=function(){return l;}
  
this.setMarginTop=function(val)
  {
   obj.style.marginTop=val;t=val;
  }
  
this.getMarginLeft=function(){return t;}
  

Outlook: just consider the background and the border of the panel control

this.setBackground=function(image,xy)
  {
    obj.style.backgroundImage="url("+image+")";
    
switch(xy)
    {
       
case 'x':
         obj.style.backgroundRepeat='repeat-x';
       
break;
       
case 'y':
       obj.style.backgroundRepeat='repeat-y';
       
break;
    }
  }

this.setBorder=function(boderWidth,color,type)
  {
    obj.style.border=boderWidth+"px "+color+ " "+type;
  }

  

 add function :

     this.add=function()
    {
         childIndex++;
         
var ch=new Child();
         ch.setParent(pid);
         ch.setTag('div');
         ch.setId(pid+childIndex);
         
return ch.getId();
  
   }

   this.setVisibilty=function(val)
   {
     
if(val==true){obj.style.display='block';}
     
else if(val==false){obj.style.display='none';}
   }

Total js code:

function Child()
{
  
var pa;
  
var chi;
  
this.setParent=function(pid)
  {
    pa=document.getElementById(pid);
  }
  
this.setTag=function(tag)
  {
      chi=document.createElement(tag);
      pa.appendChild(chi);
  }
  
this.setId=function(Name)
  {
    chi.id=Name;

}
  
this.setClassName=function(css)
  {
   chi.className=css;
  }
  
  
this.getId=function(){return chi.id;}
  
this.getObject=function(){return document.getElementById(chi.id);}

}

function createHtmlPanel(pid)
{
     
var baba=document.getElementById(pid);
         baba.className='panel';
}

function Panel(pid)
{

var childIndex=-1;
  createHtmlPanel(pid);
  
var w,h,l,t;
  
var obj=document.getElementById(pid);
  
  
this.setWidth=function(val)
  {
   w=val;
   obj.style.width=w;
  }
  
this.getWidth=function(){return w;}
  
this.setHeight=function(val)
  {
   obj.style.height=val;
   h=val;
  }
  
this.getHeight=function(){return h;}
  
this.setMarginLeft=function(val)
  {
   l=val;obj.style.marginLeft=val;
  }
  
this.getMarginLeft=function(){return l;}
  
this.setMarginTop=function(val)
  {
   obj.style.marginTop=val;t=val;
  }
  
this.getMarginLeft=function(){return t;}
  
  
this.setSize=function(wi,he)
  {
     
this.setWidth(wi);
     
this.setHeight(he);    
  }
  
  
this.setMargin=function(lef,top)
  {
   
this.setMarginLeft(lef);
   
this.setMarginTop(top);
  }
  
  
this.setBackground=function(image,xy)
  {
    obj.style.backgroundImage="url("+image+")";
    
switch(xy)
    {
       
case 'x':
         obj.style.backgroundRepeat='repeat-x';
       
break;
       
case 'y':
       obj.style.backgroundRepeat='repeat-y';
       
break;

}
  }
  
  
this.setBorder=function(boderWidth,color,type)
  {
    obj.style.border=boderWidth+"px "+color+ " "+type;
  }
  
  
this.getId=function()
  {
   
return pid;
  }
  
     
this.add=function()
    {
         childIndex++;
         
var ch=new Child();
         ch.setParent(pid);
         ch.setTag('div');
         ch.setId(pid+childIndex);
         
return ch.getId();
  
   }
   
this.setVisibilty=function(val)
   {
     
if(val==true){obj.style.display='block';}
     
else if(val==false){obj.style.display='none';}
   }

}

Html aspect:

<div id="Top"></div>
<div id="left"></div>
<div id="right"></div>
<div id="bottom"></div>
<div id="center"></div>

<script language="javascript" type="text/javascript">

var pan1=new Panel('Top');
     pan1.setSize(1000,200);
     pan1.setMargin(100,0);
     pan1.setBackground('images/no.png','x');
     pan1.setBorder(1,'#333','solid');
     
     
 
var pan2=new Panel('left');
     pan2.setSize(200,300);
     pan2.setMargin(100,200+5);
     pan2.setBackground('images/SmallScreen.png','xy');
     pan2.setBorder(1,'#333','solid');

var pan2=new Panel('right');
     pan2.setSize(200,300);
     pan2.setMargin(900,200+5);
     pan2.setBackground('images/SmallScreen.png','xy');
     pan2.setBorder(1,'#333','solid');
 
var pan1=new Panel('bottom');
     pan1.setSize(1000,50);
     pan1.setMargin(100,500);
     pan1.setBackground('images/no.png','x');
     pan1.setBorder(1,'#333','solid');

</script>

 

 

转载于:https://www.cnblogs.com/ammar/archive/2009/12/27/1633312.html

[ORGINAL]OOP Panel control design(based on web )相关推荐

  1. 【演化计算】【论文研读】Completely Automated CNN Architecture Design Based on Blocks

    Completely Automated CNN Architecture Design Based on Blocks 论文研读 I. INTRODUCTION II. BACKGROUND A. ...

  2. 嵌入Windows User Control到ASP.NET web form

    嵌入Windows User Control到ASP.NET web form 实现步骤: 新建Windows User Control项目,加入自己想做的事情(一些控件.方法.属性) 新建或打开We ...

  3. 基于Vue JS, Webpack 以及Material Design的渐进式web应用 [Part 1]

    基于Vue JS, Webpack 以及Material Design的渐进式web应用 [Part 1] 原文:基于Vue JS, Webpack 以及Material Design的渐进式web应 ...

  4. [译]基于Vue JS, Webpack 以及Material Design的渐进式web应用 [Part 1]

    渐进式web应用是大势所趋.越来越多的大公司开始使用这些技术(比如推特:https://mobile.twitter.com/). 想象你可以在地铁中浏览一个web应用,这个应用能够向用户推送通知并且 ...

  5. 零基础学习CANoe Panel(16)—— Clock Control/Panel Control/Start Stop Control/Tab Control

  6. 电影点评系统论文java_毕业设计(论文)-基于web的电影点评系统分析与设计.docx...

    毕业设计(论文) 论文题目 基于web的电影点评系统分析与设计 thesis Topic Movie reviews system analysis and design based on web A ...

  7. Control Web Panel 中两个严重漏洞使Linux 服务器易受RCE攻击

     聚焦源代码安全,网罗国内外最新资讯! 编译:代码卫士 研究人员详述了位于 Control Web Panel 中的两个严重漏洞.它们可用于利用链中,在受影响服务器上实现预认证远程代码执行. 第一个漏 ...

  8. A Complete ActiveX Web Control Tutorial

    VC++开发ActiveX 控件 转载:http://www.codeproject.com/KB/COM/CompleteActiveX.aspx 效果图如下: Introduction Activ ...

  9. Responsive Web Design 简单介绍与优缺点、实作入门, 响应式设计

    这一两年中最夯的网页设计不外乎就是Responsive Web Design 了,中文译名为「自适应网页设计」(不过这个名称仍然不太好),就字面上意思来说就是当一个网页在不同的解析度下,会呈现不同的介 ...

最新文章

  1. jsp中jsp中群发邮件群发邮件
  2. AI模型变身文豪:“看懂”新闻报道,命名图片更有文采
  3. python3编译器怎么下载_Python编译器及Sublime Text3安装及开发环境配置
  4. 网页中图片大小类型等属性不可用
  5. Kafka集成Spring-AcknowledgeMessageListener接口实现
  6. linux pam模块 cron,Linux-PAM 1.1.2 中文文档 - 6.32. pam_tally-登录计数器(统计)模块 | Docs4dev...
  7. Linux 统计代码行数
  8. vivado 一次性设置多线程编译
  9. java编程思想--final关键字
  10. win10非核心版本的计算机上
  11. 2022年网络安全行业发展趋势
  12. SEO分析关键词策略
  13. 北京人都是什么文案鬼才,被他们的抗阳段子笑死了
  14. 计算机主机光盘故障,电脑开机之后提示插入安装光盘的解决方法
  15. Walkthrough: Word 2007 XML 格式
  16. C++ define的用法
  17. 时钟表24进制HTML,24进制数字电子钟时计器、译码显示电路 具有自动清零功能
  18. virtualbox虚拟机环境搭建之一---Ubuntu1804安装Virtualbox,在Virtualbox中导入Win7镜像
  19. 疯狂Java讲义(十三)----第五部分
  20. 解决win10 的代理 IE可以正常代理,但chrome无法使用

热门文章

  1. Oracle RAC 客户端连接负载均衡(Load Balance)
  2. 参数NLS_LENGTH_SEMANTICS的设置问题
  3. Mac 删除应用卸载后无法正常移除的图标
  4. SPOJ SUMPRO(数学)
  5. 如何从完整的文件路径中分离文件名和路径名?
  6. Java的setmargin,Java Sheet.setMargin方法代碼示例
  7. 每日程序C语言33-打印杨辉三角
  8. demod函数_MATLAB信号处理工具箱函数 | 学步园
  9. 企业网站 源码 服务邮箱:_口碑营销:乌海腾讯企业邮箱服务报价
  10. Java黑皮书课后题第3章:3.14(游戏:猜硬币的正反面)编写程序,让用户猜一猜是硬币的正面还是反面。随即产生一个整数0或1,分别表示