private void update(Hyperlink hyperlink, Object object) { String text = labelProvider != null ? labelProvider.getText(object) : object.toString(); Image image = labelProvider != null ? labelProvider.getImage(object) : null; String tooltip = labelProvider != null ? labelProvider.getToolTipText(object) : text; hyperlink.setText(text); hyperlink.setToolTipText(tooltip); if (hyperlink instanceof ImageHyperlink) ((ImageHyperlink) hyperlink).setImage(image); reflow(); }
private void createLink(Object object) { Image image = labelProvider != null ? labelProvider.getImage(object) : null; Hyperlink hyperlink; if (image != null) { hyperlink = getManagedForm().getToolkit().createImageHyperlink(linkContainer, SWT.NULL); ((ImageHyperlink) hyperlink).setImage(image); } else hyperlink = getManagedForm().getToolkit().createHyperlink(linkContainer, null, SWT.NULL); update(hyperlink, object); hyperlink.setData(object); hyperlink.addHyperlinkListener(linkHandler); }
/** * ハイパーリンクの設定 * * @param sheet シート * @param nRow 対象行番号 * @param nColumn 対象列番号 * @param value ハイパーリンクテキスト * @param url ハイパーリンク先URL */ public static void setHyperLink( XSSFSheet sheet, int nRow, int nColumn, String value, String url) { assert sheet != null; XSSFWorkbook workbook = sheet.getWorkbook(); CreationHelper helper = workbook.getCreationHelper(); Hyperlink hyperlink = helper.createHyperlink(Hyperlink.LINK_URL); hyperlink.setAddress(url); XSSFRow row = getRowAnyway(sheet, nRow); XSSFCell cell = getCellAnyway(row, nColumn); cell.setCellValue(value); cell.setHyperlink(hyperlink); // ハイパーリンクテキストの装飾 XSSFFont font = workbook.createFont(); XSSFCellStyle style = workbook.createCellStyle(); // font.setColor(new XSSFColor(new Color(0, 0, 255))); font.setUnderline(XSSFFont.U_SINGLE); style.setFont(font); cell.setCellStyle(style); }
public void reset() { Road road = edgenode.getRoad(); if (road != null) { roadLink.setText(road.getName()); roadLink.setEnabled(true); nodeLink.setText(road.getOtherNode(edgenode).getName()); nodeLink.setEnabled(true); } else { roadLink.setText("null"); roadLink.setEnabled(false); nodeLink.setText("null"); nodeLink.setEnabled(false); } }
public EditEdgeNodePanel(ConfigDialog cd, EdgeNode e) { super(cd); Label clab = new Label("Connects:"); clab.setBounds(0, 0, 100, 20); add(clab); roadLink = new Hyperlink(); roadLink.addActionListener(this); roadLink.setBounds(100, 0, 100, 20); add(roadLink); Label wlab = new Label("With:"); wlab.setBounds(0, 20, 100, 20); add(wlab); nodeLink = new Hyperlink(); nodeLink.addActionListener(this); nodeLink.setBounds(100, 20, 100, 20); add(nodeLink); setEdgeNode(e); }
@FXML private void onRegisterHyperlinkClick(ActionEvent event) { FXMLLoader loader = new FXMLLoader(); Stage dialogStage = new Stage(); Parent root = null; dialogStage.setTitle("Register for sQuire"); dialogStage.initModality(Modality.WINDOW_MODAL); dialogStage.initOwner(registerHyperlink.getScene().getWindow()); dialogStage.setResizable(false); try { root = loader.load(getClass().getResource("/fxml/RegisterDialog.fxml")); Scene scene = new Scene(root); dialogStage.setScene(scene); dialogStage.showAndWait(); } catch (Exception e) { e.printStackTrace(); } }
@Override public void onModuleLoad() { box = new AutoProgressMessageBox("Por favor espere", "Carregando sistema..."); box.setProgressText("Iniciando..."); box.auto(); box.show(); Timer t = new Timer() { // float i; @Override public void run() { // box.updateProgress(i / 100, "{0}% Completo"); // i += 10; // ageitar contadores servico.iniciaSistema( new AsyncCallback<String>() { @Override public void onFailure(Throwable caught) { AlertMessageBox d = new AlertMessageBox( "Desculpe", "Erro ao carregar sistema." + caught.getMessage()); // d.addHideHandler(hideHandler); d.show(); // cancel(); } @Override public void onSuccess(String result) { // AlertMessageBox d = new AlertMessageBox("Alerta", "OK"); // d.addHideHandler(hideHandler); // d.show(); } }); // if (i > 100) { // cancel(); // } box.hide(); cancel(); } }; t.scheduleRepeating(3000); // painel principal rootPanel = RootPanel.get(); Image image_5 = new Image("imagens/imagemPojeto.png"); rootPanel.add(image_5, 0, 0); image_5.setSize("100%", "570px"); final Label lblLogin = new Label("Login:"******"Senha:"); rootPanel.add(lblSenha, 627, 285); // botao criar conta final TextButton txtbtnCriarContaAgora = new TextButton("Criar Conta Agora"); txtbtnCriarContaAgora.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { CriarConta conta = new CriarConta(); conta.load(); } }); rootPanel.add(txtbtnCriarContaAgora, 329, 360); Hyperlink htmlEsqueceuASenha = new Hyperlink("Esqueceu a senha?", true, ""); // htmlEsqueceuASenha.setStyleName("serverResponseLabelError"); htmlEsqueceuASenha.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { SenhaEsquecida senhaEsquecida = new SenhaEsquecida(); senhaEsquecida.carregar(); } }); final TextBox textBox = new TextBox(); // rootPanel.add(textBox, 676, 200); final PasswordTextBox passwordTextBox = new PasswordTextBox(); passwordTextBox.setSize("161px", "16px"); // botao logar final TextButton txtbtnLogar = new TextButton("Logar"); txtbtnLogar.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { servico.getSenhaUsuarioLogin( textBox.getText(), new AsyncCallback<String>() { @Override public void onFailure(Throwable caught) { AlertMessageBox d = new AlertMessageBox("Alerta", caught.getMessage()); d.show(); } @Override public void onSuccess(String result) { if (passwordTextBox.getText().equals(result)) { Logado log = new Logado(textBox.getText().trim(), result); rootPanel.add(log.asWidget()); } else { AlertMessageBox d = new AlertMessageBox("Alerta", "Senha incorreta."); d.show(); } } }); } }); rootPanel.add(txtbtnLogar, 676, 315); rootPanel.add(textBox, 676, 250); rootPanel.add(passwordTextBox, 678, 285); rootPanel.add(htmlEsqueceuASenha, 676, 342); }
protected void doLinkActivated(Hyperlink link) { Object object = link.getData(); getPage().getEditor().setActivePage(morePageId, object); }
private void doEnter(Hyperlink link) { String statusText = labelProvider != null ? labelProvider.getStatusText(link.getData()) : link.getText(); getPage().getEditorSite().getActionBars().getStatusLineManager().setMessage(statusText); }
private void disposeLink(Object obj) { Hyperlink link = find(obj); if (link != null) link.dispose(); }
protected SCell importCell(Cell poiCell, int row, SSheet sheet) { SCell cell = sheet.getCell(row, poiCell.getColumnIndex()); cell.setCellStyle(importCellStyle(poiCell.getCellStyle())); switch (poiCell.getCellType()) { case Cell.CELL_TYPE_NUMERIC: cell.setNumberValue(poiCell.getNumericCellValue()); break; case Cell.CELL_TYPE_STRING: RichTextString poiRichTextString = poiCell.getRichStringCellValue(); if (poiRichTextString != null && poiRichTextString.numFormattingRuns() > 0) { SRichText richText = cell.setupRichTextValue(); importRichText(poiCell, poiRichTextString, richText); } else { cell.setStringValue(poiCell.getStringCellValue()); } break; case Cell.CELL_TYPE_BOOLEAN: cell.setBooleanValue(poiCell.getBooleanCellValue()); break; case Cell.CELL_TYPE_FORMULA: cell.setFormulaValue(poiCell.getCellFormula()); // ZSS-873 if (isImportCache() && !poiCell.isCalcOnLoad() && !mustCalc(cell)) { ValueEval val = null; switch (poiCell.getCachedFormulaResultType()) { case Cell.CELL_TYPE_NUMERIC: val = new NumberEval(poiCell.getNumericCellValue()); break; case Cell.CELL_TYPE_STRING: RichTextString poiRichTextString0 = poiCell.getRichStringCellValue(); if (poiRichTextString0 != null && poiRichTextString0.numFormattingRuns() > 0) { SRichText richText = new RichTextImpl(); importRichText(poiCell, poiRichTextString0, richText); val = new StringEval(richText.getText()); } else { val = new StringEval(poiCell.getStringCellValue()); } break; case Cell.CELL_TYPE_BOOLEAN: val = BoolEval.valueOf(poiCell.getBooleanCellValue()); break; case Cell.CELL_TYPE_ERROR: val = ErrorEval.valueOf(poiCell.getErrorCellValue()); break; case Cell.CELL_TYPE_BLANK: default: // do nothing } if (val != null) { ((AbstractCellAdv) cell).setFormulaResultValue(val); } } break; case Cell.CELL_TYPE_ERROR: cell.setErrorValue(PoiEnumConversion.toErrorCode(poiCell.getErrorCellValue())); break; case Cell.CELL_TYPE_BLANK: // do nothing because spreadsheet model auto creates blank cells default: // TODO log: leave an unknown cell type as a blank cell. break; } Hyperlink poiHyperlink = poiCell.getHyperlink(); if (poiHyperlink != null) { String addr = poiHyperlink.getAddress(); String label = poiHyperlink.getLabel(); SHyperlink hyperlink = cell.setupHyperlink( PoiEnumConversion.toHyperlinkType(poiHyperlink.getType()), addr == null ? "" : addr, label == null ? "" : label); cell.setHyperlink(hyperlink); } Comment poiComment = poiCell.getCellComment(); if (poiComment != null) { SComment comment = cell.setupComment(); comment.setAuthor(poiComment.getAuthor()); comment.setVisible(poiComment.isVisible()); RichTextString poiRichTextString = poiComment.getString(); if (poiRichTextString != null && poiRichTextString.numFormattingRuns() > 0) { importRichText(poiCell, poiComment.getString(), comment.setupRichText()); } else { comment.setText(poiComment.toString()); } } return cell; }