private void ProcessSelectionChange() { this.Cursor = Cursors.WaitCursor; var items = lstView.SelectedItems; if (items.Count != 1) { previewControl.Clear(); this.Cursor = Cursors.Default; return; } else { if (items[0].Tag.GetType() == typeof(ObjDigSimples)) { var selectedItem = (ObjDigSimples)items[0].Tag; if (selectedItem == null && FedoraHelper.HasObjDigReadPermission(selectedItem.pid)) { previewControl.Clear(); return; } previewControl.ShowPDF(selectedItem.pid); } else if (items[0].Tag.GetType() == typeof(Anexo)) { previewControl.ShowAnexo(items[0].Tag as Anexo); } else if (items[0].Tag.GetType() == typeof(GISADataset.ObjetoDigitalRow)) { var selectedItem = (GISADataset.ObjetoDigitalRow)items[0].Tag; previewControl.ShowPDF(selectedItem.pid); } } this.Cursor = Cursors.Default; }
private void RefreshDetails(TreeNode node) { controlFedoraPdfViewer1.BringToFront(); if (node != null && node.Nodes.Count == 0) // não mostrar pdf do composto { var odRow = node.Tag as GISADataset.ObjetoDigitalRow; if (FedoraHelper.HasObjDigReadPermission(odRow.pid)) { this.controlFedoraPdfViewer1.ShowPDF(odRow.pid); } } else { ClearPreview(); } }
private void cmbQuality_SelectedIndexChanged(object sender, EventArgs e) { if (lastSelectedIndex == cmbQuality.SelectedIndex) { return; } lastSelectedIndex = cmbQuality.SelectedIndex; if (objectoActual != null) { if (objectoActual.GetType() == typeof(Anexo)) { ShowAnexo(objectoActual as Anexo); } else if (objectoActual.GetType() == typeof(String) && FedoraHelper.HasObjDigReadPermission(objectoActual as string)) { ShowPDF(objectoActual as string); } } }
private ListViewItem AddODSimplesToList(ObjDigSimples objSimples) { var hasReadPermission = true; if (objSimples.state != State.added) { hasReadPermission = FedoraHelper.HasObjDigReadPermission(objSimples.pid); } var item = DocumentoSimplesOrderManager1.CreateItem(FedoraHelper.GetDesignacaoUI(objSimples.pid), objSimples.titulo, objSimples.state == State.added ? "" : objSimples.pid, objSimples.publicado, objSimples); // marcar os objetos simples para os quais não existe permissão de leitura if (!hasReadPermission) { item.ForeColor = Color.Gray; } if (objSimples.state == State.notFound) { item.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, FontStyle.Italic, System.Drawing.GraphicsUnit.Point, System.Convert.ToByte(0)); } return(item); }
private void OrderManagerSelectedIndexChangedEvent(object sender, BeforeNewSelectionEventArgs e) { this.Cursor = Cursors.WaitCursor; try { if (sender == DocumentoSimplesOrderManager1) { var item = e.ItemToBeSelected; var selectedOD = default(ObjDigital); if (item != null && item.Tag != null) { selectedOD = item.Tag as ObjDigital; } else { // Limpar browser se nada estiver seleccionado var items = DocumentoSimplesOrderManager1.getTrulySelectedItems(); if (items.Count != 1) { previewControl.Clear(true); DocumentoSimplesOrderManager1.updateToolBarButtons(); return; } selectedOD = items[0].Tag as ObjDigital; } if (selectedOD == null || (selectedOD != null && selectedOD.state == State.added)) { previewControl.Clear(); DocumentoSimplesOrderManager1.updateToolBarButtons(); return; } if (!FedoraHelper.HasObjDigWritePermission(selectedOD.pid)) { DocumentoSimplesOrderManager1.ActivateReadOnlyMode(); } else { DocumentoSimplesOrderManager1.DeactivateReadOnlyMode(); } if (FedoraHelper.HasObjDigReadPermission(selectedOD.pid)) { previewControl.Clear(true); previewControl.ShowPDF(selectedOD.pid); } else { previewControl.Clear(true); } if (disableSave) { DocumentoSimplesOrderManager1.DisableToolBar(); } } else if (sender == FicheirosOrderManager1) { var item = e.ItemToBeSelected; if (item != null && item.Tag != null) { previewControl.ShowAnexo(item.Tag as Anexo); } else { var items = FicheirosOrderManager1.getTrulySelectedItems(); if (items.Count != 1) { previewControl.Clear(true); return; } previewControl.ShowAnexo(items[0].Tag as Anexo); } FicheirosOrderManager1.updateToolBarButtons(); } } finally { this.Cursor = Cursors.Default; } }
public void ShowFullScreenMode(List <ListViewItem> itemsToDisplay, int selectedItemIndex) { // Clonar a lista de nós a apresentar em modo full screen List <ListViewItem> clonedItemList = new List <ListViewItem>(); FormFullScreenPdf ecraCompleto = null; if (mViewMode == ObjetoDigitalFedoraHelper.Contexto.imagens) { clonedItemList.AddRange(itemsToDisplay.Select(item => item.Clone() as ListViewItem)); // Instanciar uma janela modal para mostrar a lista clonada (passamos o identificador do objeto pai, caso exista) ecraCompleto = new FormFullScreenPdf(clonedItemList, selectedItemIndex, FedoraHelper.TranslateQualityEnum(previewControl.Qualidade)); } else { clonedItemList.AddRange(itemsToDisplay .Where(item => item.Tag.GetType() == typeof(ObjDigSimples) && FedoraHelper.HasObjDigReadPermission(((ObjDigSimples)item.Tag).pid)) .Select(item => new ListViewItem(item.SubItems[DocumentoSimplesOrderManager1.colDesignacaoOD.Index].Text) { Tag = item.Tag })); int newSelectedItemIndex = -1; if (selectedItemIndex >= 0) { var od = itemsToDisplay[selectedItemIndex].Tag as ObjDigSimples; newSelectedItemIndex = od == null ? -1 : clonedItemList.FindIndex(item => ((ObjDigSimples)item.Tag).pid.Equals(od.pid)); } // Instanciar uma janela modal para mostrar a lista clonada (passamos o identificador do objeto pai, caso exista) ecraCompleto = new FormFullScreenPdf(clonedItemList, newSelectedItemIndex, FedoraHelper.TranslateQualityEnum(previewControl.Qualidade)); } ecraCompleto.ShowDialog(); }
public void ModelToView() { grpNiveisOrObjFed.Visible = true; if (mViewMode == ObjetoDigitalFedoraHelper.Contexto.objetosDigitais) { grpODTitleAndPub.Enabled = true; // configurar check que permite criar ou não um OD composto chkKeepODComposto.Visible = true; chkPublicar.Enabled = false; txtTitulo.Text = mTitulo; // configurar lista de ODs DocumentoSimplesOrderManager1.Visible = true; var itemsToBeAdded = new List <ListViewItem>(); if (mCurrentODComp != null) { chkPublicar.Checked = mCurrentODComp.publicado; mCurrentODComp.objSimples.ForEach(objSimples => itemsToBeAdded.Add(AddODSimplesToList(objSimples))); } else { mCurrentODSimples.ForEach(objSimples => itemsToBeAdded.Add(AddODSimplesToList(objSimples))); } // adicionar os subdocumentos sem objeto digital à lista docSimplesSemOD.ForEach(docSimples => { if ((int)docSimples.guiorder - 1 < itemsToBeAdded.Count) { itemsToBeAdded.Insert((int)docSimples.guiorder - 1, AddDocSimplesToList(docSimples)); } else { itemsToBeAdded.Add(AddDocSimplesToList(docSimples)); } }); if (itemsToBeAdded.Count > 0) { DocumentoSimplesOrderManager1.populateItems(itemsToBeAdded); DocumentoSimplesOrderManager1.selectFirst(); } if (itemsToBeAdded.Count(lvi => lvi.Tag.GetType() == typeof(ObjDigital) && ((ObjDigital)lvi.Tag).state == State.notFound) > 0) { disableSave = true; DocumentoSimplesOrderManager1.DisableToolBar(); grpODTitleAndPub.Enabled = false; chkKeepODComposto.Enabled = false; MessageBox.Show("A unidade informacional selecionada tem associado(s) objeto(s) " + System.Environment.NewLine + "digital(ais) o(s) qual(ais) não foi possivel obter do repositório. " + System.Environment.NewLine + "Por esse motivo não será possível efetuar qualquer alteração nesta área. " + System.Environment.NewLine + "Contacte o administrador de sistemas.", "Objeto(s) digital(ais) não encontrado(s)", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (itemsToBeAdded.Count > 0 && itemsToBeAdded[0].Tag.GetType() == typeof(SubDocumento)) { DocumentoSimplesOrderManager1.SetEditMixedMode(); } else { DocumentoSimplesOrderManager1.updateToolBarButtons(); } UpdateGrpODComposto(); } else if (mViewMode == ObjetoDigitalFedoraHelper.Contexto.imagens) { chkKeepODComposto.Visible = false; FicheirosOrderManager1.Visible = true; FicheirosOrderManager1.updateToolBarButtons(); grpNiveisOrObjFed.Visible = true; versionControl.Visible = true; chkPublicar.Enabled = true; txtTitulo.Enabled = true; txtTitulo.Text = mTitulo; FicheirosOrderManager1.Enabled = true; versionControl.Enabled = true; if (mCurrentODSimples.Count == 0) { grpODTitleAndPub.Enabled = false; versionControl.Reset(); versionControl.Enabled = false; return; } var odSimples = mCurrentODSimples[0]; txtTitulo.Text = odSimples.titulo; chkPublicar.Checked = odSimples.publicado; if (!FedoraHelper.HasObjDigReadPermission(odSimples.pid)) { FicheirosOrderManager1.Enabled = false; return; } var itemsToBeAdded = new List <ListViewItem>(); odSimples.fich_associados.ForEach(f => { var datastream = f as Anexo; var item = FicheirosOrderManager1.CreateItem(datastream.url, datastream); itemsToBeAdded.Add(item); }); versionControl.Load(odSimples); if (!FedoraHelper.HasObjDigWritePermission(odSimples.pid)) { FicheirosOrderManager1.ActivateReadOnlyMode(); } } else { grpNiveisOrObjFed.Visible = false; } }