/// <summary> /// Implementação do Render do controlo /// </summary> /// <param name="output"></param> protected override void Render(HtmlTextWriter output) { //---------------------------------------------------------------- // Definição da classe //---------------------------------------------------------------- this.CssClass = "OWCheckBox"; if (this.ReadOnly) { string Style = string.Format("WIDTH:{0}; HEIGHT:{1}", base.Width.ToString(), base.Height.ToString()); string LabelDescription; string CheckedDescription; CheckedDescription = base.Checked ? ResX.GetString("YES") : ResX.GetString("NO"); if (base.Text.Trim() != string.Empty) { LabelDescription = string.Format("{0} ({1})", base.Text, CheckedDescription); } else { LabelDescription = CheckedDescription; } output.Write(string.Format("<SPAN style='{0}' class='{1}'>{2}</SPAN>", Style, CssClass, LabelDescription)); } else { base.Render(output); } }
/// <summary> /// Render this control to the output parameter specified. /// </summary> /// <param name="output"> The HTML writer to write out to </param> protected override void Render(HtmlTextWriter output) { if (TabStripItems != null) { if (TabStripItems.Count > 0) { div.RenderControl(output); } else { output.Write(ResX.GetString("NoTabDefined")); } } else { output.Write(ResX.GetString("NoTabDefined")); } }
/// <summary> /// Override do método Render para que, no caso do control estar disabled, /// mostre apenas uma label com o texto do item seleccionado /// </summary> /// <param name="output"></param> protected override void Render(HtmlTextWriter output) { base.CssClass = "OWRadioButtonList"; if (!base.Enabled) { if (base.SelectedItem == null) { output.Write(ResX.GetString("NoItemSelected")); } else { output.Write(base.SelectedItem.Text); } } else { base.Render(output); } }
/// <summary> /// Implementação do método Render /// </summary> /// <param name="output"></param> protected override void Render(HtmlTextWriter output) { base.CssClass = "OWRadioButton"; if (this.ReadOnly) { string CTRLStyle = string.Format("WIDTH:{0}; HEIGHT:{1}", base.Width.ToString(), base.Height.ToString()); string CTRLText; string CTRLChecked; if (base.Checked) { CTRLChecked = ResX.GetString("YES"); } else { CTRLChecked = ResX.GetString("NO"); } if (base.Text != "") { CTRLText = string.Format("{0} ({1})", base.Text, CTRLChecked); } else { CTRLText = CTRLChecked; } output.Write(string.Format("<SPAN style='{0}' class='{1}'>{2}</SPAN>", CTRLStyle, CssClass, CTRLText)); } else { base.Render(output); } }
//override do método render protected override void Render(HtmlTextWriter output) { string bSTRmessage; switch (_OWStatusBarType) { case StatusBarType.StatusConfirm: { bSTRmessage = ResX.GetString("ConfirmDelRecord"); break; } case StatusBarType.StatusInformation: { bSTRmessage = ResX.GetString("SuccessMsg"); break; } case StatusBarType.StatusHidden: { bSTRmessage = " "; break; } default: { bSTRmessage = " "; break; } } base.Width = new Unit(100, UnitType.Percentage); base.CssClass = "WARNINGS"; base.Text = bSTRmessage; base.Render(output); }
/// <summary> /// Construção do item inicial da lista /// </summary> private void BuildFirstItem() { //-------------------------------------------------------------------- // Inserção do Item Inicial //-------------------------------------------------------------------- ListItem li = new ListItem(); li.Value = string.Empty; bool insertLine = true; switch (this.ItemType) { case ItemTypeEnum.itemAll: if (this.Items != null && this.Items.Count > 0 && // Nota: Só suporta PT e EN (Melhorar) (this.Items[0].Text == "<Todos>" || this.Items[0].Text == "<All>" ) ) { if (ResX.GetSelectedCulture().StartsWith("pt")) { this.Items[0].Text = "<Todos>"; } else { this.Items[0].Text = "<All>"; } insertLine = false; break; } if (ResX.GetSelectedCulture().StartsWith("pt")) { li.Text = "<Todos>"; } else { li.Text = "<All>"; } break; case ItemTypeEnum.itemSelect: if (this.Items != null && this.Items.Count > 0 && // Nota: Só suporta PT e EN (Melhorar) (this.Items[0].Text == "<Seleccione>" || this.Items[0].Text == "<Select>" ) ) { if (ResX.GetSelectedCulture().StartsWith("pt")) { this.Items[0].Text = "<Seleccione>"; } else { this.Items[0].Text = "<Select>"; } insertLine = false; break; } if (ResX.GetSelectedCulture().StartsWith("pt")) { li.Text = "<Seleccione>"; } else { li.Text = "<Select>"; } break; case ItemTypeEnum.itemEmpty: if (this.Items != null && this.Items.Count > 0 && this.Items[0].Text == string.Empty) { insertLine = false; break; } li.Text = string.Empty; break; default: insertLine = false; break; } if (insertLine) { this.Items.Insert(0, li); } }
/// <summary> /// Tratamento do evento de criação de um item /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnItemCreated(object sender, DataGridItemEventArgs e) { if (e != null && e.Item != null) { //---------------------------------------------------------------- // Criação de uma referência para o Header da grid //---------------------------------------------------------------- if (e.Item.ItemType == ListItemType.Header) { this.HeaderItem = e.Item; } //---------------------------------------------------------------- // - Criação de uma referência para o Footer da grid // - Criação de linhas em Lopes no fim da lista para para preencher // o número de linhas do tamanho da página //---------------------------------------------------------------- if (e.Item.ItemType == ListItemType.Footer) { this.FooterItem = e.Item; if (this.AllwaysShowBlankRows) { this.AddBlankRows(); } else if (this.ShowBlankRows && this.AllowPaging) { this.AddBlankRows(); } } //---------------------------------------------------------------- // Tratamento do item Pager //---------------------------------------------------------------- if (e.Item.ItemType == ListItemType.Pager && this.BuiltInPaging) { //Maintable HtmlTable maintable = new HtmlTable(); maintable.Rows.Add(new HtmlTableRow()); maintable.Width = "100%"; maintable.Rows[0].Cells.Add(new HtmlTableCell()); maintable.Rows[0].Cells.Add(new HtmlTableCell()); maintable.Rows[0].Cells.Add(new HtmlTableCell()); maintable.Rows[0].Cells[0].Width = "33%"; maintable.Rows[0].Cells[1].Width = "33%"; maintable.Rows[0].Cells[2].Width = "33%"; //Paginator table HtmlTable table = new HtmlTable(); table.Rows.Add(new HtmlTableRow()); table.Align = "center"; table.Rows[0].Cells.Add(new HtmlTableCell()); table.Rows[0].Cells.Add(new HtmlTableCell()); table.Rows[0].Cells.Add(new HtmlTableCell()); table.Rows[0].Cells.Add(new HtmlTableCell()); table.Rows[0].Cells.Add(new HtmlTableCell()); table.Rows[0].Cells.Add(new HtmlTableCell()); OWLinkButton First = new OWLinkButton(); OWLinkButton Previous = new OWLinkButton(); OWLinkButton Next = new OWLinkButton(); OWLinkButton Last = new OWLinkButton(); First.CausesValidation = false; Previous.CausesValidation = false; Next.CausesValidation = false; Last.CausesValidation = false; First.Click += new EventHandler(this.OnClickFirst); Previous.Click += new EventHandler(this.OnClickPrevious); Next.Click += new EventHandler(this.OnClickNext); Last.Click += new EventHandler(this.OnClickLast); First.Text = "<<"; Previous.Text = "<"; Next.Text = ">"; Last.Text = ">>"; int pageNumber = this.CurrentPageIndex + 1; int pageCount = this.PageCount; //Show buttons if not in first page if (pageNumber > 1) { table.Rows[0].Cells[0].Controls.Add(First); table.Rows[0].Cells[1].Controls.Add(Previous); } //Pages info if (ResX.GetSelectedCulture().StartsWith("pt")) { table.Rows[0].Cells[2].InnerText = string.Format("Página {0} de {1}", pageNumber, (pageCount == 0?1:pageCount)); } else { table.Rows[0].Cells[2].InnerText = string.Format("Page {0} of {1}", pageNumber, (pageCount == 0?1:pageCount)); } //Show buttons if pages exists or not in last page if (pageNumber != pageCount && pageCount != 0) { table.Rows[0].Cells[3].Controls.Add(Next); table.Rows[0].Cells[4].Controls.Add(Last); } //End of paginator table //Add paginator table to maintable maintable.Rows[0].Cells[1].Controls.Clear(); maintable.Rows[0].Cells[1].Controls.Add(table); //Add total of records to maintable maintable.Rows[0].Cells[2].InnerText = "Total: " + this.rowCount.ToString(); maintable.Rows[0].Cells[2].Attributes.Add("align", "right"); //Add navigator table e.Item.Controls[0].Controls.Clear(); e.Item.Controls[0].Controls.AddAt(0, maintable); } } }
/// <summary> /// Implementação do evento Render /// </summary> /// <param name="output"></param> protected override void Render(HtmlTextWriter output) { //------------------------------------------------------------ // Definição da classe a aplicar //------------------------------------------------------------ base.CssClass = this.ReadOnly ? "OWTextBoxReadOnly" : "OWTextBox"; //------------------------------------------------------------ // Definição do alignment do control //------------------------------------------------------------ if (this.AlignmentType != AlignmentTypeEnum.NotSet) { base.Style.Add("TEXT-ALIGN", this.AlignmentType.ToString().ToLower()); } //------------------------------------------------------------ // Definição do comportamente AutoExpand do controlo //------------------------------------------------------------ if (this.AutoExpand) { base.Style.Add("OVERFLOW", "Auto"); base.TextMode = TextBoxMode.MultiLine; base.Height = new Unit(0, UnitType.Pixel); } //------------------------------------------------------------ // Caso o modo seja multiline, e esteja definido um tamanho // máximo, vai ser implementado o código para fazer essa gestão //------------------------------------------------------------ if (base.TextMode == TextBoxMode.MultiLine && base.MaxLength > 0) { base.Attributes.Add("onkeypress", "if (this.value.length + 1 > " + base.MaxLength.ToString() + ") return false;"); base.Attributes.Add("onchange", "if (this.value.length > " + base.MaxLength.ToString() + ") { this.value = this.value.substring(0, " + base.MaxLength.ToString() + "); alert('" + ResX.GetString("ExceededSizeMsg", base.MaxLength.ToString()) + "')}"); } //------------------------------------------------------------ // Caso seja multi-line, vai ser forçado o border //------------------------------------------------------------ if (base.TextMode == TextBoxMode.MultiLine && base.ReadOnly) { base.BorderStyle = BorderStyle.Inset; } //------------------------------------------------------------ // Render do comportamento base //------------------------------------------------------------ base.Render(output); }